From 83a0231562956dbea148c7374fbf73a344a2300d Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 14 May 2026 09:55:42 +0800 Subject: [PATCH] Regenerate azure-mgmt-automation with latest code generator tool --- .../azure-mgmt-automation/CHANGELOG.md | 6 + .../azure-mgmt-automation/MANIFEST.in | 9 +- .../azure-mgmt-automation/README.md | 6 +- .../azure-mgmt-automation/_meta.json | 11 - .../azure-mgmt-automation/_metadata.json | 11 + .../apiview-properties.json | 488 ++++ .../azure-mgmt-automation/azure/__init__.py | 2 +- .../azure/mgmt/__init__.py | 2 +- .../azure/mgmt/automation/__init__.py | 12 +- .../mgmt/automation/_automation_client.py | 226 +- .../azure/mgmt/automation/_configuration.py | 18 +- .../azure/mgmt/automation/_patch.py | 1 + .../azure/mgmt/automation/_utils/__init__.py | 6 + .../serialization.py} | 601 ++--- .../azure/mgmt/automation/_vendor.py | 26 - .../azure/mgmt/automation/_version.py | 3 +- .../azure/mgmt/automation/aio/__init__.py | 12 +- .../mgmt/automation/aio/_automation_client.py | 228 +- .../mgmt/automation/aio/_configuration.py | 18 +- .../azure/mgmt/automation/aio/_patch.py | 1 + .../azure/mgmt/automation/aio/_vendor.py | 26 - .../automation/aio/operations/__init__.py | 145 +- .../aio/operations/_activity_operations.py | 43 +- ...ent_registration_information_operations.py | 41 +- .../_automation_account_operations.py | 85 +- .../_automation_client_operations.py | 167 -- .../aio/operations/_certificate_operations.py | 72 +- .../aio/operations/_connection_operations.py | 88 +- .../operations/_connection_type_operations.py | 65 +- .../aio/operations/_credential_operations.py | 67 +- ..._deleted_automation_accounts_operations.py | 103 - .../_dsc_compilation_job_operations.py | 63 +- .../_dsc_compilation_job_stream_operations.py | 32 +- .../_dsc_configuration_operations.py | 79 +- .../_dsc_node_configuration_operations.py | 65 +- .../aio/operations/_dsc_node_operations.py | 77 +- .../aio/operations/_fields_operations.py | 34 +- ..._hybrid_runbook_worker_group_operations.py | 253 +- .../_hybrid_runbook_workers_operations.py | 609 ----- .../aio/operations/_job_operations.py | 135 +- .../operations/_job_schedule_operations.py | 63 +- .../aio/operations/_job_stream_operations.py | 43 +- .../aio/operations/_keys_operations.py | 32 +- .../_linked_workspace_operations.py | 32 +- .../aio/operations/_module_operations.py | 72 +- .../_node_count_information_operations.py | 32 +- .../operations/_node_reports_operations.py | 54 +- .../_object_data_types_operations.py | 45 +- .../automation/aio/operations/_operations.py | 34 +- .../mgmt/automation/aio/operations/_patch.py | 1 + ...private_endpoint_connections_operations.py | 523 ---- .../_private_link_resources_operations.py | 127 - .../operations/_python2_package_operations.py | 72 +- .../operations/_python3_package_operations.py | 554 ----- .../operations/_runbook_draft_operations.py | 63 +- .../aio/operations/_runbook_operations.py | 87 +- .../aio/operations/_schedule_operations.py | 72 +- ...e_configuration_machine_runs_operations.py | 41 +- ...re_update_configuration_runs_operations.py | 41 +- ...ftware_update_configurations_operations.py | 61 +- .../operations/_source_control_operations.py | 72 +- .../_source_control_sync_job_operations.py | 52 +- ...rce_control_sync_job_streams_operations.py | 43 +- .../aio/operations/_statistics_operations.py | 34 +- .../aio/operations/_test_job_operations.py | 74 +- .../_test_job_streams_operations.py | 43 +- .../aio/operations/_usages_operations.py | 34 +- .../aio/operations/_variable_operations.py | 72 +- .../aio/operations/_watcher_operations.py | 94 +- .../aio/operations/_webhook_operations.py | 69 +- .../azure/mgmt/automation/models/__init__.py | 457 ++-- .../models/_automation_client_enums.py | 40 - .../mgmt/automation/models/_models_py3.py | 2127 +++++------------ .../azure/mgmt/automation/models/_patch.py | 1 + .../mgmt/automation/operations/__init__.py | 145 +- .../operations/_activity_operations.py | 55 +- ...ent_registration_information_operations.py | 53 +- .../_automation_account_operations.py | 107 +- .../_automation_client_operations.py | 206 -- .../operations/_certificate_operations.py | 94 +- .../operations/_connection_operations.py | 112 +- .../operations/_connection_type_operations.py | 83 +- .../operations/_credential_operations.py | 89 +- ..._deleted_automation_accounts_operations.py | 132 - .../_dsc_compilation_job_operations.py | 83 +- .../_dsc_compilation_job_stream_operations.py | 40 +- .../_dsc_configuration_operations.py | 105 +- .../_dsc_node_configuration_operations.py | 83 +- .../operations/_dsc_node_operations.py | 97 +- .../operations/_fields_operations.py | 42 +- ..._hybrid_runbook_worker_group_operations.py | 313 +-- .../_hybrid_runbook_workers_operations.py | 822 ------- .../automation/operations/_job_operations.py | 167 +- .../operations/_job_schedule_operations.py | 81 +- .../operations/_job_stream_operations.py | 55 +- .../automation/operations/_keys_operations.py | 40 +- .../_linked_workspace_operations.py | 40 +- .../operations/_module_operations.py | 94 +- .../_node_count_information_operations.py | 40 +- .../operations/_node_reports_operations.py | 70 +- .../_object_data_types_operations.py | 57 +- .../mgmt/automation/operations/_operations.py | 39 +- .../mgmt/automation/operations/_patch.py | 1 + ...private_endpoint_connections_operations.py | 672 ------ .../_private_link_resources_operations.py | 162 -- .../operations/_python2_package_operations.py | 94 +- .../operations/_python3_package_operations.py | 725 ------ .../operations/_runbook_draft_operations.py | 90 +- .../operations/_runbook_operations.py | 129 +- .../operations/_schedule_operations.py | 94 +- ...e_configuration_machine_runs_operations.py | 53 +- ...re_update_configuration_runs_operations.py | 53 +- ...ftware_update_configurations_operations.py | 79 +- .../operations/_source_control_operations.py | 94 +- .../_source_control_sync_job_operations.py | 68 +- ...rce_control_sync_job_streams_operations.py | 55 +- .../operations/_statistics_operations.py | 42 +- .../operations/_test_job_operations.py | 102 +- .../_test_job_streams_operations.py | 59 +- .../operations/_usages_operations.py | 42 +- .../operations/_variable_operations.py | 94 +- .../operations/_watcher_operations.py | 120 +- .../operations/_webhook_operations.py | 83 +- ...compilation_job_stream_by_job_stream_id.py | 3 +- .../compilation_job_stream_list.py | 3 +- .../create_compilation_job.py | 3 +- .../generated_samples/create_job_schedule.py | 3 +- .../create_or_update_automation_account.py | 3 +- .../create_or_update_certificate.py | 3 +- .../create_or_update_connection.py | 3 +- .../create_or_update_connection_type.py | 3 +- .../create_or_update_credential.py | 3 +- .../create_or_update_dsc_configuration.py | 3 +- ...create_or_update_dsc_node_configuration.py | 3 +- .../create_or_update_module.py | 3 +- .../create_or_update_python2_package.py | 3 +- .../create_or_update_python3_package.py | 56 - .../create_or_update_runbook.py | 3 +- .../create_or_update_schedule.py | 3 +- .../create_or_update_variable.py | 3 +- .../create_or_update_watcher.py | 6 +- .../create_or_update_webhook.py | 1 + .../create_runbook_as_draft.py | 3 +- .../generated_samples/create_test_job.py | 3 +- .../delete_automation_account.py | 3 +- .../generated_samples/delete_certificate.py | 3 +- .../generated_samples/delete_connection.py | 6 +- .../delete_connection_type.py | 3 +- .../delete_credential_existing.py | 3 +- .../delete_dsc_configuration.py | 3 +- .../generated_samples/delete_dsc_node.py | 6 +- .../delete_dsc_node_configuration.py | 3 +- .../delete_hybrid_runbook_worker.py | 43 - .../delete_hybrid_runbook_worker_group.py | 3 +- .../generated_samples/delete_job_schedule.py | 3 +- .../generated_samples/delete_module.py | 3 +- .../delete_python2_package.py | 3 +- .../delete_python3_package.py | 42 - .../generated_samples/delete_runbook.py | 3 +- .../generated_samples/delete_schedule.py | 3 +- .../generated_samples/delete_variable.py | 3 +- .../generated_samples/delete_watcher.py | 3 +- .../generated_samples/delete_webhook.py | 1 + .../deserialize_graph_runbook_content.py | 49 - .../get_activity_in_amodule.py | 3 +- .../get_agent_registration.py | 3 +- .../get_all_connection_types_first100.py | 3 +- .../get_all_connection_types_next100.py | 3 +- .../get_all_dsc_configurations.py | 3 +- .../get_automation_account.py | 3 +- .../generated_samples/get_certificate.py | 3 +- .../generated_samples/get_compilation_job.py | 3 +- .../generated_samples/get_connection.py | 3 +- .../generated_samples/get_connection_type.py | 3 +- .../generated_samples/get_credential.py | 3 +- .../get_deleted_automation_account.py | 39 - .../get_dsc_configuration.py | 3 +- .../get_dsc_configuration_content.py | 3 +- .../generated_samples/get_dsc_node.py | 3 +- .../get_dsc_node_configuration.py | 3 +- .../generated_samples/get_dsc_node_report.py | 3 +- .../get_dsc_node_report_content.py | 3 +- .../generated_samples/get_job_schedule.py | 3 +- .../generated_samples/get_linked_workspace.py | 3 +- .../generated_samples/get_module.py | 3 +- ...paged_dsc_configurations_with_no_filter.py | 3 +- ...edl_dsc_configurations_with_name_filter.py | 3 +- .../generated_samples/get_python2_package.py | 3 +- .../generated_samples/get_python3_package.py | 43 - .../generated_samples/get_runbook.py | 3 +- .../generated_samples/get_runbook_content.py | 3 +- .../generated_samples/get_runbook_draft.py | 3 +- .../get_runbook_draft_content.py | 3 +- .../generated_samples/get_schedule.py | 3 +- .../get_statistics_of_automation_account.py | 3 +- .../generated_samples/get_test_job.py | 3 +- .../generated_samples/get_test_job_stream.py | 3 +- .../get_usages_of_automation_account.py | 3 +- .../generated_samples/get_variable.py | 3 +- .../generated_samples/get_watcher.py | 3 +- .../generated_samples/get_webhook.py | 1 + ....py => hybrid_runbook_worker_group_get.py} | 5 +- ...py => hybrid_runbook_worker_group_list.py} | 7 +- ... => hybrid_runbook_worker_group_update.py} | 9 +- .../generated_samples/job/create_job.py | 3 +- .../generated_samples/job/get_job.py | 3 +- .../generated_samples/job/get_job_output.py | 3 +- .../job/get_job_runbook_content.py | 3 +- .../generated_samples/job/get_job_stream.py | 3 +- .../job/list_job_streams_by_job.py | 3 +- .../job/list_jobs_by_automation_account.py | 3 +- .../generated_samples/job/resume_job.py | 3 +- .../generated_samples/job/stop_job.py | 3 +- .../generated_samples/job/suspend_job.py | 3 +- .../list_activities_by_module.py | 3 +- ...ist_all_dsc_nodes_by_automation_account.py | 3 +- ...all_job_schedules_by_automation_account.py | 3 +- .../list_automation_account_keys.py | 3 +- ...t_automation_accounts_by_resource_group.py | 3 +- ...ist_automation_accounts_by_subscription.py | 3 +- ...list_certificates_by_automation_account.py | 3 +- ..._compilation_jobs_by_automation_account.py | 3 +- ...nections_by_automation_account_first100.py | 3 +- ...nnections_by_automation_account_next100.py | 3 +- .../list_credentials_by_automation_account.py | 3 +- ...omation_account_next100_using_next_link.py | 3 +- .../list_dsc_node_configurations.py | 3 +- .../list_dsc_node_reports_by_node.py | 3 +- .../list_fields_by_module_and_type.py | 3 +- .../generated_samples/list_fields_by_type.py | 3 +- .../list_hybrid_runbook_worker.py | 44 - .../list_modules_by_automation_account.py | 3 +- ...ist_paged_dsc_node_configuration_counts.py | 3 +- ...sc_node_configurations_with_name_filter.py | 3 +- ..._dsc_node_configurations_with_no_filter.py | 3 +- .../list_paged_dsc_node_reports_by_node.py | 44 - .../list_paged_dsc_node_status_counts.py | 3 +- ...utomation_account_with_composite_filter.py | 3 +- ..._by_automation_account_with_name_filter.py | 3 +- ...es_by_automation_account_with_no_filter.py | 3 +- ...t_with_node_configuration_custom_filter.py | 3 +- ..._node_configuration_not_assigned_filter.py | 3 +- ...y_automation_account_with_status_filter.py | 3 +- ..._automation_account_with_version_filter.py | 3 +- ..._python2_packages_by_automation_account.py | 3 +- ..._python3_packages_by_automation_account.py | 43 - .../list_rest_api_operations.py | 40 - .../list_runbooks_by_automation_account.py | 3 +- ...chedules_by_automation_account_first100.py | 3 +- ...schedules_by_automation_account_next100.py | 3 +- .../list_test_job_streams_by_job.py | 3 +- .../list_variables_first100.py | 3 +- .../list_variables_next100.py | 3 +- .../list_watchers_by_automation_account.py | 3 +- .../list_webhooks_by_automation_account.py | 1 + .../private_endpoint_connection_delete.py | 42 - .../private_endpoint_connection_get.py | 43 - .../private_endpoint_connection_list_get.py | 43 - .../private_endpoint_connection_update.py | 51 - .../private_link_resource_list_get.py | 43 - .../generated_samples/publish_runbook.py | 3 +- .../regenerate_agent_registration_key.py | 3 +- .../replace_runbook_draft_content.py | 3 +- .../generated_samples/resume_test_job.py | 3 +- .../serialize_graph_runbook_content.py | 43 - .../create_software_update_configuration.py | 11 +- .../delete_software_update_configuration.py | 3 +- ...t_software_update_configuration_by_name.py | 3 +- .../list_software_update_configurations.py | 3 +- ...st_software_update_configurations_by_vm.py | 3 +- ..._update_configuration_machine_run_by_id.py | 3 +- ...tware_update_configuration_machine_runs.py | 3 +- ...pdate_configuration_machine_runs_by_run.py | 3 +- ...software_update_configuration_run_by_id.py | 3 +- ...iled_software_update_configuration_runs.py | 3 +- ...list_software_update_configuration_runs.py | 3 +- .../create_or_update_source_control.py | 3 +- .../source_control/delete_source_control.py | 3 +- .../source_control/get_all_source_controls.py | 3 +- .../source_control/get_source_control.py | 3 +- .../update_source_control_patch.py | 3 +- .../create_source_control_sync_job.py | 3 +- .../get_all_source_control_sync_jobs.py | 3 +- .../get_source_control_sync_job.py | 3 +- .../get_source_control_sync_job_streams.py | 3 +- ...e_control_sync_job_streams_by_stream_id.py | 3 +- .../generated_samples/start_watcher.py | 3 +- .../generated_samples/stop_test_job.py | 3 +- .../generated_samples/stop_watcher.py | 3 +- .../generated_samples/suspend_test_job.py | 3 +- ...raft_edit_to_last_known_published_state.py | 3 +- .../update_automation_account.py | 3 +- .../generated_samples/update_certificate.py | 3 +- .../generated_samples/update_connection.py | 3 +- .../update_credential_patch.py | 3 +- .../update_dsc_configuration.py | 3 +- .../generated_samples/update_dsc_node.py | 3 +- .../generated_samples/update_module.py | 3 +- .../update_python2_package.py | 3 +- .../update_python3_package.py | 44 - .../generated_samples/update_runbook.py | 3 +- .../generated_samples/update_schedule.py | 3 +- .../update_variable_patch.py | 3 +- .../generated_samples/update_watcher.py | 3 +- .../generated_samples/update_webhook.py | 1 + .../generated_samples/webhook_generate_uri.py | 1 + .../generated_tests/conftest.py | 2 +- .../test_automation_activity_operations.py | 8 +- ...st_automation_activity_operations_async.py | 8 +- ...ent_registration_information_operations.py | 8 +- ...gistration_information_operations_async.py | 8 +- ...utomation_automation_account_operations.py | 50 +- ...ion_automation_account_operations_async.py | 50 +- .../test_automation_certificate_operations.py | 20 +- ...automation_certificate_operations_async.py | 20 +- .../test_automation_connection_operations.py | 20 +- ..._automation_connection_operations_async.py | 20 +- ...t_automation_connection_type_operations.py | 16 +- ...mation_connection_type_operations_async.py | 16 +- .../test_automation_credential_operations.py | 20 +- ..._automation_credential_operations_async.py | 20 +- ...tomation_dsc_compilation_job_operations.py | 16 +- ...on_dsc_compilation_job_operations_async.py | 16 +- ...n_dsc_compilation_job_stream_operations.py | 4 +- ...compilation_job_stream_operations_async.py | 4 +- ...automation_dsc_configuration_operations.py | 24 +- ...tion_dsc_configuration_operations_async.py | 24 +- ...ation_dsc_node_configuration_operations.py | 16 +- ...dsc_node_configuration_operations_async.py | 16 +- .../test_automation_dsc_node_operations.py | 16 +- ...st_automation_dsc_node_operations_async.py | 16 +- .../test_automation_fields_operations.py | 4 +- ...test_automation_fields_operations_async.py | 4 +- ..._hybrid_runbook_worker_group_operations.py | 32 +- ...d_runbook_worker_group_operations_async.py | 32 +- .../test_automation_job_operations.py | 32 +- .../test_automation_job_operations_async.py | 32 +- ...test_automation_job_schedule_operations.py | 16 +- ...utomation_job_schedule_operations_async.py | 16 +- .../test_automation_job_stream_operations.py | 8 +- ..._automation_job_stream_operations_async.py | 8 +- .../test_automation_keys_operations.py | 4 +- .../test_automation_keys_operations_async.py | 4 +- ..._automation_linked_workspace_operations.py | 4 +- ...ation_linked_workspace_operations_async.py | 4 +- .../test_automation_module_operations.py | 20 +- ...test_automation_module_operations_async.py | 20 +- ...ation_node_count_information_operations.py | 4 +- ...node_count_information_operations_async.py | 4 +- ...test_automation_node_reports_operations.py | 12 +- ...utomation_node_reports_operations_async.py | 12 +- ...automation_object_data_types_operations.py | 8 +- ...tion_object_data_types_operations_async.py | 8 +- .../test_automation_operations.py | 4 +- .../test_automation_operations_async.py | 4 +- ...t_automation_python2_package_operations.py | 20 +- ...mation_python2_package_operations_async.py | 20 +- ...est_automation_runbook_draft_operations.py | 16 +- ...tomation_runbook_draft_operations_async.py | 16 +- .../test_automation_runbook_operations.py | 28 +- ...est_automation_runbook_operations_async.py | 28 +- .../test_automation_schedule_operations.py | 20 +- ...st_automation_schedule_operations_async.py | 20 +- ...e_configuration_machine_runs_operations.py | 8 +- ...iguration_machine_runs_operations_async.py | 8 +- ...re_update_configuration_runs_operations.py | 8 +- ...ate_configuration_runs_operations_async.py | 8 +- ...ftware_update_configurations_operations.py | 16 +- ..._update_configurations_operations_async.py | 16 +- ...st_automation_source_control_operations.py | 20 +- ...omation_source_control_operations_async.py | 20 +- ...tion_source_control_sync_job_operations.py | 12 +- ...ource_control_sync_job_operations_async.py | 12 +- ...rce_control_sync_job_streams_operations.py | 8 +- ...ntrol_sync_job_streams_operations_async.py | 8 +- .../test_automation_statistics_operations.py | 4 +- ..._automation_statistics_operations_async.py | 4 +- .../test_automation_test_job_operations.py | 20 +- ...st_automation_test_job_operations_async.py | 20 +- ..._automation_test_job_streams_operations.py | 8 +- ...ation_test_job_streams_operations_async.py | 8 +- .../test_automation_usages_operations.py | 4 +- ...test_automation_usages_operations_async.py | 4 +- .../test_automation_variable_operations.py | 20 +- ...st_automation_variable_operations_async.py | 20 +- .../test_automation_watcher_operations.py | 28 +- ...est_automation_watcher_operations_async.py | 28 +- .../test_automation_webhook_operations.py | 12 +- ...est_automation_webhook_operations_async.py | 12 +- .../azure-mgmt-automation/pyproject.toml | 82 + .../azure-mgmt-automation/sdk_packaging.toml | 7 - sdk/automation/azure-mgmt-automation/setup.py | 85 - 392 files changed, 6234 insertions(+), 11897 deletions(-) delete mode 100644 sdk/automation/azure-mgmt-automation/_meta.json create mode 100644 sdk/automation/azure-mgmt-automation/_metadata.json create mode 100644 sdk/automation/azure-mgmt-automation/apiview-properties.json create mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/__init__.py rename sdk/automation/azure-mgmt-automation/azure/mgmt/automation/{_serialization.py => _utils/serialization.py} (81%) delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_vendor.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_vendor.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_client_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_deleted_automation_accounts_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_workers_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_link_resources_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python3_package_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_client_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_deleted_automation_accounts_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_workers_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_link_resources_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python3_package_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python3_package.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/delete_python3_package.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/deserialize_graph_runbook_content.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/get_deleted_automation_account.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/get_python3_package.py rename sdk/automation/azure-mgmt-automation/generated_samples/{get_hybrid_runbook_worker_group.py => hybrid_runbook_worker_group_get.py} (89%) rename sdk/automation/azure-mgmt-automation/generated_samples/{list_hybrid_runbook_worker_group.py => hybrid_runbook_worker_group_list.py} (86%) rename sdk/automation/azure-mgmt-automation/generated_samples/{get_hybrid_runbook_worker.py => hybrid_runbook_worker_group_update.py} (82%) delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_reports_by_node.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/list_python3_packages_by_automation_account.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/list_rest_api_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_delete.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_get.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_list_get.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_update.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/private_link_resource_list_get.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/serialize_graph_runbook_content.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/update_python3_package.py delete mode 100644 sdk/automation/azure-mgmt-automation/sdk_packaging.toml delete mode 100644 sdk/automation/azure-mgmt-automation/setup.py diff --git a/sdk/automation/azure-mgmt-automation/CHANGELOG.md b/sdk/automation/azure-mgmt-automation/CHANGELOG.md index 43a31f6746fb..6a72e91b8dc3 100644 --- a/sdk/automation/azure-mgmt-automation/CHANGELOG.md +++ b/sdk/automation/azure-mgmt-automation/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.0.1 (2026-05-14) + +### Other Changes + + - Regenerated with latest code generator tool + ## 1.1.0b4 (2024-11-05) ### Other Changes diff --git a/sdk/automation/azure-mgmt-automation/MANIFEST.in b/sdk/automation/azure-mgmt-automation/MANIFEST.in index 985fcfd9ce20..67fd039c1d69 100644 --- a/sdk/automation/azure-mgmt-automation/MANIFEST.in +++ b/sdk/automation/azure-mgmt-automation/MANIFEST.in @@ -1,8 +1,7 @@ -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/automation/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/automation/azure-mgmt-automation/README.md b/sdk/automation/azure-mgmt-automation/README.md index 115c463e20bd..8815da824314 100644 --- a/sdk/automation/azure-mgmt-automation/README.md +++ b/sdk/automation/azure-mgmt-automation/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Automation Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.10+. 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.8+ is required to use this package. +- Python 3.10+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ 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. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/automation/azure-mgmt-automation/_meta.json b/sdk/automation/azure-mgmt-automation/_meta.json deleted file mode 100644 index fef7e751fada..000000000000 --- a/sdk/automation/azure-mgmt-automation/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "690a7656d65a03b134fa44fc7bb8013dc18a15b5", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.19.0", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/automation/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-2022-08-08 --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/automation/resource-manager/readme.md" -} \ No newline at end of file diff --git a/sdk/automation/azure-mgmt-automation/_metadata.json b/sdk/automation/azure-mgmt-automation/_metadata.json new file mode 100644 index 000000000000..58000c38ae2c --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/_metadata.json @@ -0,0 +1,11 @@ +{ + "commit": "85a5e103401c5c039f7071e7d5df47cee124443f", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.10.2", + "use": [ + "@autorest/python@6.50.0", + "@autorest/modelerfour@4.27.0" + ], + "autorest_command": "autorest specification/automation/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --package-mode=azure-mgmt --python --python-sdks-folder=C:\\dev\\azure-sdk-for-python\\sdk --tag=package-2018-06-preview --use=@autorest/python@6.50.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "readme": "specification/automation/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/automation/azure-mgmt-automation/apiview-properties.json b/sdk/automation/azure-mgmt-automation/apiview-properties.json new file mode 100644 index 000000000000..d70fee36f6c4 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/apiview-properties.json @@ -0,0 +1,488 @@ +{ + "CrossLanguagePackageId": null, + "CrossLanguageDefinitionId": { + "azure.mgmt.automation.models.Activity": null, + "azure.mgmt.automation.models.ActivityListResult": null, + "azure.mgmt.automation.models.ActivityOutputType": null, + "azure.mgmt.automation.models.ActivityParameter": null, + "azure.mgmt.automation.models.ActivityParameterSet": null, + "azure.mgmt.automation.models.ActivityParameterValidationSet": null, + "azure.mgmt.automation.models.AdvancedSchedule": null, + "azure.mgmt.automation.models.AdvancedScheduleMonthlyOccurrence": null, + "azure.mgmt.automation.models.AgentRegistration": null, + "azure.mgmt.automation.models.AgentRegistrationKeys": null, + "azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter": null, + "azure.mgmt.automation.models.Resource": null, + "azure.mgmt.automation.models.TrackedResource": null, + "azure.mgmt.automation.models.AutomationAccount": null, + "azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters": null, + "azure.mgmt.automation.models.AutomationAccountListResult": null, + "azure.mgmt.automation.models.AutomationAccountUpdateParameters": null, + "azure.mgmt.automation.models.AzureQueryProperties": null, + "azure.mgmt.automation.models.ProxyResource": null, + "azure.mgmt.automation.models.Certificate": null, + "azure.mgmt.automation.models.CertificateCreateOrUpdateParameters": null, + "azure.mgmt.automation.models.CertificateListResult": null, + "azure.mgmt.automation.models.CertificateUpdateParameters": null, + "azure.mgmt.automation.models.CollectionItemUpdateConfiguration": null, + "azure.mgmt.automation.models.Connection": null, + "azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters": null, + "azure.mgmt.automation.models.ConnectionListResult": null, + "azure.mgmt.automation.models.ConnectionType": null, + "azure.mgmt.automation.models.ConnectionTypeAssociationProperty": null, + "azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters": null, + "azure.mgmt.automation.models.ConnectionTypeListResult": null, + "azure.mgmt.automation.models.ConnectionUpdateParameters": null, + "azure.mgmt.automation.models.ContentHash": null, + "azure.mgmt.automation.models.ContentLink": null, + "azure.mgmt.automation.models.ContentSource": null, + "azure.mgmt.automation.models.Credential": null, + "azure.mgmt.automation.models.CredentialCreateOrUpdateParameters": null, + "azure.mgmt.automation.models.CredentialListResult": null, + "azure.mgmt.automation.models.CredentialUpdateParameters": null, + "azure.mgmt.automation.models.DscCompilationJob": null, + "azure.mgmt.automation.models.DscCompilationJobCreateParameters": null, + "azure.mgmt.automation.models.DscCompilationJobListResult": null, + "azure.mgmt.automation.models.DscConfiguration": null, + "azure.mgmt.automation.models.DscConfigurationAssociationProperty": null, + "azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters": null, + "azure.mgmt.automation.models.DscConfigurationListResult": null, + "azure.mgmt.automation.models.DscConfigurationParameter": null, + "azure.mgmt.automation.models.DscConfigurationUpdateParameters": null, + "azure.mgmt.automation.models.DscMetaConfiguration": null, + "azure.mgmt.automation.models.DscNode": null, + "azure.mgmt.automation.models.DscNodeConfiguration": null, + "azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters": null, + "azure.mgmt.automation.models.DscNodeConfigurationListResult": null, + "azure.mgmt.automation.models.DscNodeExtensionHandlerAssociationProperty": null, + "azure.mgmt.automation.models.DscNodeListResult": null, + "azure.mgmt.automation.models.DscNodeReport": null, + "azure.mgmt.automation.models.DscNodeReportListResult": null, + "azure.mgmt.automation.models.DscNodeUpdateParameters": null, + "azure.mgmt.automation.models.DscNodeUpdateParametersProperties": null, + "azure.mgmt.automation.models.DscReportError": null, + "azure.mgmt.automation.models.DscReportResource": null, + "azure.mgmt.automation.models.DscReportResourceNavigation": null, + "azure.mgmt.automation.models.ErrorResponse": null, + "azure.mgmt.automation.models.FieldDefinition": null, + "azure.mgmt.automation.models.HybridRunbookWorker": null, + "azure.mgmt.automation.models.HybridRunbookWorkerGroup": null, + "azure.mgmt.automation.models.HybridRunbookWorkerGroupsListResult": null, + "azure.mgmt.automation.models.HybridRunbookWorkerGroupUpdateParameters": null, + "azure.mgmt.automation.models.Job": null, + "azure.mgmt.automation.models.JobCollectionItem": null, + "azure.mgmt.automation.models.JobCreateParameters": null, + "azure.mgmt.automation.models.JobListResultV2": null, + "azure.mgmt.automation.models.JobNavigation": null, + "azure.mgmt.automation.models.JobSchedule": null, + "azure.mgmt.automation.models.JobScheduleCreateParameters": null, + "azure.mgmt.automation.models.JobScheduleListResult": null, + "azure.mgmt.automation.models.JobStream": null, + "azure.mgmt.automation.models.JobStreamListResult": null, + "azure.mgmt.automation.models.Key": null, + "azure.mgmt.automation.models.KeyListResult": null, + "azure.mgmt.automation.models.LinkedWorkspace": null, + "azure.mgmt.automation.models.LinuxProperties": null, + "azure.mgmt.automation.models.Module": null, + "azure.mgmt.automation.models.ModuleCreateOrUpdateParameters": null, + "azure.mgmt.automation.models.ModuleErrorInfo": null, + "azure.mgmt.automation.models.ModuleListResult": null, + "azure.mgmt.automation.models.ModuleUpdateParameters": null, + "azure.mgmt.automation.models.NodeCount": null, + "azure.mgmt.automation.models.NodeCountProperties": null, + "azure.mgmt.automation.models.NodeCounts": null, + "azure.mgmt.automation.models.NonAzureQueryProperties": null, + "azure.mgmt.automation.models.Operation": null, + "azure.mgmt.automation.models.OperationDisplay": null, + "azure.mgmt.automation.models.OperationListResult": null, + "azure.mgmt.automation.models.PythonPackageCreateParameters": null, + "azure.mgmt.automation.models.PythonPackageUpdateParameters": null, + "azure.mgmt.automation.models.RunAsCredentialAssociationProperty": null, + "azure.mgmt.automation.models.Runbook": null, + "azure.mgmt.automation.models.RunbookAssociationProperty": null, + "azure.mgmt.automation.models.RunbookCreateOrUpdateDraftParameters": null, + "azure.mgmt.automation.models.RunbookCreateOrUpdateDraftProperties": null, + "azure.mgmt.automation.models.RunbookCreateOrUpdateParameters": null, + "azure.mgmt.automation.models.RunbookDraft": null, + "azure.mgmt.automation.models.RunbookDraftUndoEditResult": null, + "azure.mgmt.automation.models.RunbookListResult": null, + "azure.mgmt.automation.models.RunbookParameter": null, + "azure.mgmt.automation.models.RunbookUpdateParameters": null, + "azure.mgmt.automation.models.Schedule": null, + "azure.mgmt.automation.models.ScheduleAssociationProperty": null, + "azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters": null, + "azure.mgmt.automation.models.ScheduleListResult": null, + "azure.mgmt.automation.models.ScheduleProperties": null, + "azure.mgmt.automation.models.ScheduleUpdateParameters": null, + "azure.mgmt.automation.models.Sku": null, + "azure.mgmt.automation.models.SoftareUpdateConfigurationRunTaskProperties": null, + "azure.mgmt.automation.models.SoftareUpdateConfigurationRunTasks": null, + "azure.mgmt.automation.models.SoftwareUpdateConfiguration": null, + "azure.mgmt.automation.models.SoftwareUpdateConfigurationCollectionItem": null, + "azure.mgmt.automation.models.SoftwareUpdateConfigurationListResult": null, + "azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun": null, + "azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRunListResult": null, + "azure.mgmt.automation.models.SoftwareUpdateConfigurationRun": null, + "azure.mgmt.automation.models.SoftwareUpdateConfigurationRunListResult": null, + "azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks": null, + "azure.mgmt.automation.models.SourceControl": null, + "azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters": null, + "azure.mgmt.automation.models.SourceControlListResult": null, + "azure.mgmt.automation.models.SourceControlSecurityTokenProperties": null, + "azure.mgmt.automation.models.SourceControlSyncJob": null, + "azure.mgmt.automation.models.SourceControlSyncJobById": null, + "azure.mgmt.automation.models.SourceControlSyncJobCreateParameters": null, + "azure.mgmt.automation.models.SourceControlSyncJobListResult": null, + "azure.mgmt.automation.models.SourceControlSyncJobStream": null, + "azure.mgmt.automation.models.SourceControlSyncJobStreamById": null, + "azure.mgmt.automation.models.SourceControlSyncJobStreamsListBySyncJob": null, + "azure.mgmt.automation.models.SourceControlUpdateParameters": null, + "azure.mgmt.automation.models.Statistics": null, + "azure.mgmt.automation.models.StatisticsListResult": null, + "azure.mgmt.automation.models.TagSettingsProperties": null, + "azure.mgmt.automation.models.TargetProperties": null, + "azure.mgmt.automation.models.TaskProperties": null, + "azure.mgmt.automation.models.TestJob": null, + "azure.mgmt.automation.models.TestJobCreateParameters": null, + "azure.mgmt.automation.models.TypeField": null, + "azure.mgmt.automation.models.TypeFieldListResult": null, + "azure.mgmt.automation.models.UpdateConfiguration": null, + "azure.mgmt.automation.models.UpdateConfigurationNavigation": null, + "azure.mgmt.automation.models.Usage": null, + "azure.mgmt.automation.models.UsageCounterName": null, + "azure.mgmt.automation.models.UsageListResult": null, + "azure.mgmt.automation.models.Variable": null, + "azure.mgmt.automation.models.VariableCreateOrUpdateParameters": null, + "azure.mgmt.automation.models.VariableListResult": null, + "azure.mgmt.automation.models.VariableUpdateParameters": null, + "azure.mgmt.automation.models.Watcher": null, + "azure.mgmt.automation.models.WatcherListResult": null, + "azure.mgmt.automation.models.WatcherUpdateParameters": null, + "azure.mgmt.automation.models.Webhook": null, + "azure.mgmt.automation.models.WebhookCreateOrUpdateParameters": null, + "azure.mgmt.automation.models.WebhookListResult": null, + "azure.mgmt.automation.models.WebhookUpdateParameters": null, + "azure.mgmt.automation.models.WindowsProperties": null, + "azure.mgmt.automation.models.SkuNameEnum": null, + "azure.mgmt.automation.models.AutomationAccountState": null, + "azure.mgmt.automation.models.AutomationKeyName": null, + "azure.mgmt.automation.models.AutomationKeyPermissions": null, + "azure.mgmt.automation.models.ContentSourceType": null, + "azure.mgmt.automation.models.DscConfigurationState": null, + "azure.mgmt.automation.models.GroupTypeEnum": null, + "azure.mgmt.automation.models.ModuleProvisioningState": null, + "azure.mgmt.automation.models.ScheduleDay": null, + "azure.mgmt.automation.models.ScheduleFrequency": null, + "azure.mgmt.automation.models.TagOperators": null, + "azure.mgmt.automation.models.SourceType": null, + "azure.mgmt.automation.models.ProvisioningState": null, + "azure.mgmt.automation.models.SyncType": null, + "azure.mgmt.automation.models.StreamType": null, + "azure.mgmt.automation.models.JobStatus": null, + "azure.mgmt.automation.models.JobStreamType": null, + "azure.mgmt.automation.models.JobProvisioningState": null, + "azure.mgmt.automation.models.RunbookTypeEnum": null, + "azure.mgmt.automation.models.RunbookState": null, + "azure.mgmt.automation.models.WindowsUpdateClasses": null, + "azure.mgmt.automation.models.LinuxUpdateClasses": null, + "azure.mgmt.automation.models.TokenType": null, + "azure.mgmt.automation.models.AgentRegistrationKeyName": null, + "azure.mgmt.automation.models.CountType": null, + "azure.mgmt.automation.models.HttpStatusCode": null, + "azure.mgmt.automation.models.OperatingSystemType": null, + "azure.mgmt.automation.operations.AutomationAccountOperations.update": null, + "azure.mgmt.automation.aio.operations.AutomationAccountOperations.update": null, + "azure.mgmt.automation.operations.AutomationAccountOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.AutomationAccountOperations.create_or_update": null, + "azure.mgmt.automation.operations.AutomationAccountOperations.delete": null, + "azure.mgmt.automation.aio.operations.AutomationAccountOperations.delete": null, + "azure.mgmt.automation.operations.AutomationAccountOperations.get": null, + "azure.mgmt.automation.aio.operations.AutomationAccountOperations.get": null, + "azure.mgmt.automation.operations.AutomationAccountOperations.list_by_resource_group": null, + "azure.mgmt.automation.aio.operations.AutomationAccountOperations.list_by_resource_group": null, + "azure.mgmt.automation.operations.AutomationAccountOperations.list": null, + "azure.mgmt.automation.aio.operations.AutomationAccountOperations.list": null, + "azure.mgmt.automation.operations.Operations.list": null, + "azure.mgmt.automation.aio.operations.Operations.list": null, + "azure.mgmt.automation.operations.StatisticsOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.StatisticsOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.UsagesOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.UsagesOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.KeysOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.KeysOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.CertificateOperations.delete": null, + "azure.mgmt.automation.aio.operations.CertificateOperations.delete": null, + "azure.mgmt.automation.operations.CertificateOperations.get": null, + "azure.mgmt.automation.aio.operations.CertificateOperations.get": null, + "azure.mgmt.automation.operations.CertificateOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.CertificateOperations.create_or_update": null, + "azure.mgmt.automation.operations.CertificateOperations.update": null, + "azure.mgmt.automation.aio.operations.CertificateOperations.update": null, + "azure.mgmt.automation.operations.CertificateOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.CertificateOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.ConnectionOperations.delete": null, + "azure.mgmt.automation.aio.operations.ConnectionOperations.delete": null, + "azure.mgmt.automation.operations.ConnectionOperations.get": null, + "azure.mgmt.automation.aio.operations.ConnectionOperations.get": null, + "azure.mgmt.automation.operations.ConnectionOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.ConnectionOperations.create_or_update": null, + "azure.mgmt.automation.operations.ConnectionOperations.update": null, + "azure.mgmt.automation.aio.operations.ConnectionOperations.update": null, + "azure.mgmt.automation.operations.ConnectionOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.ConnectionOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.ConnectionTypeOperations.delete": null, + "azure.mgmt.automation.aio.operations.ConnectionTypeOperations.delete": null, + "azure.mgmt.automation.operations.ConnectionTypeOperations.get": null, + "azure.mgmt.automation.aio.operations.ConnectionTypeOperations.get": null, + "azure.mgmt.automation.operations.ConnectionTypeOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.ConnectionTypeOperations.create_or_update": null, + "azure.mgmt.automation.operations.ConnectionTypeOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.ConnectionTypeOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.CredentialOperations.delete": null, + "azure.mgmt.automation.aio.operations.CredentialOperations.delete": null, + "azure.mgmt.automation.operations.CredentialOperations.get": null, + "azure.mgmt.automation.aio.operations.CredentialOperations.get": null, + "azure.mgmt.automation.operations.CredentialOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.CredentialOperations.create_or_update": null, + "azure.mgmt.automation.operations.CredentialOperations.update": null, + "azure.mgmt.automation.aio.operations.CredentialOperations.update": null, + "azure.mgmt.automation.operations.CredentialOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.CredentialOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.DscConfigurationOperations.delete": null, + "azure.mgmt.automation.aio.operations.DscConfigurationOperations.delete": null, + "azure.mgmt.automation.operations.DscConfigurationOperations.get": null, + "azure.mgmt.automation.aio.operations.DscConfigurationOperations.get": null, + "azure.mgmt.automation.operations.DscConfigurationOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.DscConfigurationOperations.create_or_update": null, + "azure.mgmt.automation.operations.DscConfigurationOperations.update": null, + "azure.mgmt.automation.aio.operations.DscConfigurationOperations.update": null, + "azure.mgmt.automation.operations.DscConfigurationOperations.get_content": null, + "azure.mgmt.automation.aio.operations.DscConfigurationOperations.get_content": null, + "azure.mgmt.automation.operations.DscConfigurationOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.DscConfigurationOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.HybridRunbookWorkerGroupOperations.delete": null, + "azure.mgmt.automation.aio.operations.HybridRunbookWorkerGroupOperations.delete": null, + "azure.mgmt.automation.operations.HybridRunbookWorkerGroupOperations.get": null, + "azure.mgmt.automation.aio.operations.HybridRunbookWorkerGroupOperations.get": null, + "azure.mgmt.automation.operations.HybridRunbookWorkerGroupOperations.update": null, + "azure.mgmt.automation.aio.operations.HybridRunbookWorkerGroupOperations.update": null, + "azure.mgmt.automation.operations.HybridRunbookWorkerGroupOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.HybridRunbookWorkerGroupOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.JobScheduleOperations.delete": null, + "azure.mgmt.automation.aio.operations.JobScheduleOperations.delete": null, + "azure.mgmt.automation.operations.JobScheduleOperations.get": null, + "azure.mgmt.automation.aio.operations.JobScheduleOperations.get": null, + "azure.mgmt.automation.operations.JobScheduleOperations.create": null, + "azure.mgmt.automation.aio.operations.JobScheduleOperations.create": null, + "azure.mgmt.automation.operations.JobScheduleOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.JobScheduleOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.LinkedWorkspaceOperations.get": null, + "azure.mgmt.automation.aio.operations.LinkedWorkspaceOperations.get": null, + "azure.mgmt.automation.operations.ActivityOperations.get": null, + "azure.mgmt.automation.aio.operations.ActivityOperations.get": null, + "azure.mgmt.automation.operations.ActivityOperations.list_by_module": null, + "azure.mgmt.automation.aio.operations.ActivityOperations.list_by_module": null, + "azure.mgmt.automation.operations.ModuleOperations.delete": null, + "azure.mgmt.automation.aio.operations.ModuleOperations.delete": null, + "azure.mgmt.automation.operations.ModuleOperations.get": null, + "azure.mgmt.automation.aio.operations.ModuleOperations.get": null, + "azure.mgmt.automation.operations.ModuleOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.ModuleOperations.create_or_update": null, + "azure.mgmt.automation.operations.ModuleOperations.update": null, + "azure.mgmt.automation.aio.operations.ModuleOperations.update": null, + "azure.mgmt.automation.operations.ModuleOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.ModuleOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.ObjectDataTypesOperations.list_fields_by_module_and_type": null, + "azure.mgmt.automation.aio.operations.ObjectDataTypesOperations.list_fields_by_module_and_type": null, + "azure.mgmt.automation.operations.ObjectDataTypesOperations.list_fields_by_type": null, + "azure.mgmt.automation.aio.operations.ObjectDataTypesOperations.list_fields_by_type": null, + "azure.mgmt.automation.operations.FieldsOperations.list_by_type": null, + "azure.mgmt.automation.aio.operations.FieldsOperations.list_by_type": null, + "azure.mgmt.automation.operations.ScheduleOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.ScheduleOperations.create_or_update": null, + "azure.mgmt.automation.operations.ScheduleOperations.update": null, + "azure.mgmt.automation.aio.operations.ScheduleOperations.update": null, + "azure.mgmt.automation.operations.ScheduleOperations.get": null, + "azure.mgmt.automation.aio.operations.ScheduleOperations.get": null, + "azure.mgmt.automation.operations.ScheduleOperations.delete": null, + "azure.mgmt.automation.aio.operations.ScheduleOperations.delete": null, + "azure.mgmt.automation.operations.ScheduleOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.ScheduleOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.VariableOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.VariableOperations.create_or_update": null, + "azure.mgmt.automation.operations.VariableOperations.update": null, + "azure.mgmt.automation.aio.operations.VariableOperations.update": null, + "azure.mgmt.automation.operations.VariableOperations.delete": null, + "azure.mgmt.automation.aio.operations.VariableOperations.delete": null, + "azure.mgmt.automation.operations.VariableOperations.get": null, + "azure.mgmt.automation.aio.operations.VariableOperations.get": null, + "azure.mgmt.automation.operations.VariableOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.VariableOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.WebhookOperations.generate_uri": null, + "azure.mgmt.automation.aio.operations.WebhookOperations.generate_uri": null, + "azure.mgmt.automation.operations.WebhookOperations.delete": null, + "azure.mgmt.automation.aio.operations.WebhookOperations.delete": null, + "azure.mgmt.automation.operations.WebhookOperations.get": null, + "azure.mgmt.automation.aio.operations.WebhookOperations.get": null, + "azure.mgmt.automation.operations.WebhookOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.WebhookOperations.create_or_update": null, + "azure.mgmt.automation.operations.WebhookOperations.update": null, + "azure.mgmt.automation.aio.operations.WebhookOperations.update": null, + "azure.mgmt.automation.operations.WebhookOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.WebhookOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.WatcherOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.WatcherOperations.create_or_update": null, + "azure.mgmt.automation.operations.WatcherOperations.get": null, + "azure.mgmt.automation.aio.operations.WatcherOperations.get": null, + "azure.mgmt.automation.operations.WatcherOperations.update": null, + "azure.mgmt.automation.aio.operations.WatcherOperations.update": null, + "azure.mgmt.automation.operations.WatcherOperations.delete": null, + "azure.mgmt.automation.aio.operations.WatcherOperations.delete": null, + "azure.mgmt.automation.operations.WatcherOperations.start": null, + "azure.mgmt.automation.aio.operations.WatcherOperations.start": null, + "azure.mgmt.automation.operations.WatcherOperations.stop": null, + "azure.mgmt.automation.aio.operations.WatcherOperations.stop": null, + "azure.mgmt.automation.operations.WatcherOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.WatcherOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationsOperations.create": null, + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationsOperations.create": null, + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationsOperations.get_by_name": null, + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationsOperations.get_by_name": null, + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationsOperations.delete": null, + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationsOperations.delete": null, + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationsOperations.list": null, + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationsOperations.list": null, + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationRunsOperations.get_by_id": null, + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationRunsOperations.get_by_id": null, + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationRunsOperations.list": null, + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationRunsOperations.list": null, + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationMachineRunsOperations.get_by_id": null, + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationMachineRunsOperations.get_by_id": null, + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationMachineRunsOperations.list": null, + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationMachineRunsOperations.list": null, + "azure.mgmt.automation.operations.SourceControlOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.SourceControlOperations.create_or_update": null, + "azure.mgmt.automation.operations.SourceControlOperations.update": null, + "azure.mgmt.automation.aio.operations.SourceControlOperations.update": null, + "azure.mgmt.automation.operations.SourceControlOperations.delete": null, + "azure.mgmt.automation.aio.operations.SourceControlOperations.delete": null, + "azure.mgmt.automation.operations.SourceControlOperations.get": null, + "azure.mgmt.automation.aio.operations.SourceControlOperations.get": null, + "azure.mgmt.automation.operations.SourceControlOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.SourceControlOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.SourceControlSyncJobOperations.create": null, + "azure.mgmt.automation.aio.operations.SourceControlSyncJobOperations.create": null, + "azure.mgmt.automation.operations.SourceControlSyncJobOperations.get": null, + "azure.mgmt.automation.aio.operations.SourceControlSyncJobOperations.get": null, + "azure.mgmt.automation.operations.SourceControlSyncJobOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.SourceControlSyncJobOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.SourceControlSyncJobStreamsOperations.list_by_sync_job": null, + "azure.mgmt.automation.aio.operations.SourceControlSyncJobStreamsOperations.list_by_sync_job": null, + "azure.mgmt.automation.operations.SourceControlSyncJobStreamsOperations.get": null, + "azure.mgmt.automation.aio.operations.SourceControlSyncJobStreamsOperations.get": null, + "azure.mgmt.automation.operations.JobOperations.get_output": null, + "azure.mgmt.automation.aio.operations.JobOperations.get_output": null, + "azure.mgmt.automation.operations.JobOperations.get_runbook_content": null, + "azure.mgmt.automation.aio.operations.JobOperations.get_runbook_content": null, + "azure.mgmt.automation.operations.JobOperations.suspend": null, + "azure.mgmt.automation.aio.operations.JobOperations.suspend": null, + "azure.mgmt.automation.operations.JobOperations.stop": null, + "azure.mgmt.automation.aio.operations.JobOperations.stop": null, + "azure.mgmt.automation.operations.JobOperations.get": null, + "azure.mgmt.automation.aio.operations.JobOperations.get": null, + "azure.mgmt.automation.operations.JobOperations.create": null, + "azure.mgmt.automation.aio.operations.JobOperations.create": null, + "azure.mgmt.automation.operations.JobOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.JobOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.JobOperations.resume": null, + "azure.mgmt.automation.aio.operations.JobOperations.resume": null, + "azure.mgmt.automation.operations.JobStreamOperations.get": null, + "azure.mgmt.automation.aio.operations.JobStreamOperations.get": null, + "azure.mgmt.automation.operations.JobStreamOperations.list_by_job": null, + "azure.mgmt.automation.aio.operations.JobStreamOperations.list_by_job": null, + "azure.mgmt.automation.operations.AgentRegistrationInformationOperations.get": null, + "azure.mgmt.automation.aio.operations.AgentRegistrationInformationOperations.get": null, + "azure.mgmt.automation.operations.AgentRegistrationInformationOperations.regenerate_key": null, + "azure.mgmt.automation.aio.operations.AgentRegistrationInformationOperations.regenerate_key": null, + "azure.mgmt.automation.operations.DscNodeOperations.delete": null, + "azure.mgmt.automation.aio.operations.DscNodeOperations.delete": null, + "azure.mgmt.automation.operations.DscNodeOperations.get": null, + "azure.mgmt.automation.aio.operations.DscNodeOperations.get": null, + "azure.mgmt.automation.operations.DscNodeOperations.update": null, + "azure.mgmt.automation.aio.operations.DscNodeOperations.update": null, + "azure.mgmt.automation.operations.DscNodeOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.DscNodeOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.NodeReportsOperations.list_by_node": null, + "azure.mgmt.automation.aio.operations.NodeReportsOperations.list_by_node": null, + "azure.mgmt.automation.operations.NodeReportsOperations.get": null, + "azure.mgmt.automation.aio.operations.NodeReportsOperations.get": null, + "azure.mgmt.automation.operations.NodeReportsOperations.get_content": null, + "azure.mgmt.automation.aio.operations.NodeReportsOperations.get_content": null, + "azure.mgmt.automation.operations.DscCompilationJobOperations.begin_create": null, + "azure.mgmt.automation.aio.operations.DscCompilationJobOperations.begin_create": null, + "azure.mgmt.automation.operations.DscCompilationJobOperations.get": null, + "azure.mgmt.automation.aio.operations.DscCompilationJobOperations.get": null, + "azure.mgmt.automation.operations.DscCompilationJobOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.DscCompilationJobOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.DscCompilationJobOperations.get_stream": null, + "azure.mgmt.automation.aio.operations.DscCompilationJobOperations.get_stream": null, + "azure.mgmt.automation.operations.DscCompilationJobStreamOperations.list_by_job": null, + "azure.mgmt.automation.aio.operations.DscCompilationJobStreamOperations.list_by_job": null, + "azure.mgmt.automation.operations.DscNodeConfigurationOperations.delete": null, + "azure.mgmt.automation.aio.operations.DscNodeConfigurationOperations.delete": null, + "azure.mgmt.automation.operations.DscNodeConfigurationOperations.get": null, + "azure.mgmt.automation.aio.operations.DscNodeConfigurationOperations.get": null, + "azure.mgmt.automation.operations.DscNodeConfigurationOperations.begin_create_or_update": null, + "azure.mgmt.automation.aio.operations.DscNodeConfigurationOperations.begin_create_or_update": null, + "azure.mgmt.automation.operations.DscNodeConfigurationOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.DscNodeConfigurationOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.NodeCountInformationOperations.get": null, + "azure.mgmt.automation.aio.operations.NodeCountInformationOperations.get": null, + "azure.mgmt.automation.operations.RunbookDraftOperations.get_content": null, + "azure.mgmt.automation.aio.operations.RunbookDraftOperations.get_content": null, + "azure.mgmt.automation.operations.RunbookDraftOperations.begin_replace_content": null, + "azure.mgmt.automation.aio.operations.RunbookDraftOperations.begin_replace_content": null, + "azure.mgmt.automation.operations.RunbookDraftOperations.get": null, + "azure.mgmt.automation.aio.operations.RunbookDraftOperations.get": null, + "azure.mgmt.automation.operations.RunbookDraftOperations.undo_edit": null, + "azure.mgmt.automation.aio.operations.RunbookDraftOperations.undo_edit": null, + "azure.mgmt.automation.operations.RunbookOperations.begin_publish": null, + "azure.mgmt.automation.aio.operations.RunbookOperations.begin_publish": null, + "azure.mgmt.automation.operations.RunbookOperations.get_content": null, + "azure.mgmt.automation.aio.operations.RunbookOperations.get_content": null, + "azure.mgmt.automation.operations.RunbookOperations.get": null, + "azure.mgmt.automation.aio.operations.RunbookOperations.get": null, + "azure.mgmt.automation.operations.RunbookOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.RunbookOperations.create_or_update": null, + "azure.mgmt.automation.operations.RunbookOperations.update": null, + "azure.mgmt.automation.aio.operations.RunbookOperations.update": null, + "azure.mgmt.automation.operations.RunbookOperations.delete": null, + "azure.mgmt.automation.aio.operations.RunbookOperations.delete": null, + "azure.mgmt.automation.operations.RunbookOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.RunbookOperations.list_by_automation_account": null, + "azure.mgmt.automation.operations.TestJobStreamsOperations.get": null, + "azure.mgmt.automation.aio.operations.TestJobStreamsOperations.get": null, + "azure.mgmt.automation.operations.TestJobStreamsOperations.list_by_test_job": null, + "azure.mgmt.automation.aio.operations.TestJobStreamsOperations.list_by_test_job": null, + "azure.mgmt.automation.operations.TestJobOperations.create": null, + "azure.mgmt.automation.aio.operations.TestJobOperations.create": null, + "azure.mgmt.automation.operations.TestJobOperations.get": null, + "azure.mgmt.automation.aio.operations.TestJobOperations.get": null, + "azure.mgmt.automation.operations.TestJobOperations.resume": null, + "azure.mgmt.automation.aio.operations.TestJobOperations.resume": null, + "azure.mgmt.automation.operations.TestJobOperations.stop": null, + "azure.mgmt.automation.aio.operations.TestJobOperations.stop": null, + "azure.mgmt.automation.operations.TestJobOperations.suspend": null, + "azure.mgmt.automation.aio.operations.TestJobOperations.suspend": null, + "azure.mgmt.automation.operations.Python2PackageOperations.delete": null, + "azure.mgmt.automation.aio.operations.Python2PackageOperations.delete": null, + "azure.mgmt.automation.operations.Python2PackageOperations.get": null, + "azure.mgmt.automation.aio.operations.Python2PackageOperations.get": null, + "azure.mgmt.automation.operations.Python2PackageOperations.create_or_update": null, + "azure.mgmt.automation.aio.operations.Python2PackageOperations.create_or_update": null, + "azure.mgmt.automation.operations.Python2PackageOperations.update": null, + "azure.mgmt.automation.aio.operations.Python2PackageOperations.update": null, + "azure.mgmt.automation.operations.Python2PackageOperations.list_by_automation_account": null, + "azure.mgmt.automation.aio.operations.Python2PackageOperations.list_by_automation_account": null + } +} \ No newline at end of file diff --git a/sdk/automation/azure-mgmt-automation/azure/__init__.py b/sdk/automation/azure-mgmt-automation/azure/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/automation/azure-mgmt-automation/azure/__init__.py +++ b/sdk/automation/azure-mgmt-automation/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/__init__.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/__init__.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/__init__.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/__init__.py index 78ecf85f77e0..ed517639ae29 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/__init__.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._automation_client import AutomationClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._automation_client import AutomationClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "AutomationClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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 01a06d89d815..42ddd75c9ac5 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 @@ -7,27 +7,27 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from ._configuration import AutomationClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import ( ActivityOperations, AgentRegistrationInformationOperations, AutomationAccountOperations, - AutomationClientOperationsMixin, CertificateOperations, ConnectionOperations, ConnectionTypeOperations, CredentialOperations, - DeletedAutomationAccountsOperations, DscCompilationJobOperations, DscCompilationJobStreamOperations, DscConfigurationOperations, @@ -35,7 +35,6 @@ DscNodeOperations, FieldsOperations, HybridRunbookWorkerGroupOperations, - HybridRunbookWorkersOperations, JobOperations, JobScheduleOperations, JobStreamOperations, @@ -46,10 +45,7 @@ NodeReportsOperations, ObjectDataTypesOperations, Operations, - PrivateEndpointConnectionsOperations, - PrivateLinkResourcesOperations, Python2PackageOperations, - Python3PackageOperations, RunbookDraftOperations, RunbookOperations, ScheduleOperations, @@ -69,48 +65,17 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class AutomationClient( - AutomationClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class AutomationClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Automation Client. - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.automation.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.automation.operations.PrivateLinkResourcesOperations - :ivar agent_registration_information: AgentRegistrationInformationOperations operations - :vartype agent_registration_information: - azure.mgmt.automation.operations.AgentRegistrationInformationOperations - :ivar dsc_node: DscNodeOperations operations - :vartype dsc_node: azure.mgmt.automation.operations.DscNodeOperations - :ivar node_reports: NodeReportsOperations operations - :vartype node_reports: azure.mgmt.automation.operations.NodeReportsOperations - :ivar dsc_compilation_job: DscCompilationJobOperations operations - :vartype dsc_compilation_job: azure.mgmt.automation.operations.DscCompilationJobOperations - :ivar dsc_compilation_job_stream: DscCompilationJobStreamOperations operations - :vartype dsc_compilation_job_stream: - azure.mgmt.automation.operations.DscCompilationJobStreamOperations - :ivar node_count_information: NodeCountInformationOperations operations - :vartype node_count_information: - azure.mgmt.automation.operations.NodeCountInformationOperations - :ivar watcher: WatcherOperations operations - :vartype watcher: azure.mgmt.automation.operations.WatcherOperations - :ivar software_update_configurations: SoftwareUpdateConfigurationsOperations operations - :vartype software_update_configurations: - azure.mgmt.automation.operations.SoftwareUpdateConfigurationsOperations - :ivar webhook: WebhookOperations operations - :vartype webhook: azure.mgmt.automation.operations.WebhookOperations - :ivar deleted_automation_accounts: DeletedAutomationAccountsOperations operations - :vartype deleted_automation_accounts: - azure.mgmt.automation.operations.DeletedAutomationAccountsOperations :ivar automation_account: AutomationAccountOperations operations :vartype automation_account: azure.mgmt.automation.operations.AutomationAccountOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.automation.operations.Operations :ivar statistics: StatisticsOperations operations :vartype statistics: azure.mgmt.automation.operations.StatisticsOperations :ivar usages: UsagesOperations operations @@ -127,19 +92,9 @@ class AutomationClient( :vartype credential: azure.mgmt.automation.operations.CredentialOperations :ivar dsc_configuration: DscConfigurationOperations operations :vartype dsc_configuration: azure.mgmt.automation.operations.DscConfigurationOperations - :ivar dsc_node_configuration: DscNodeConfigurationOperations operations - :vartype dsc_node_configuration: - azure.mgmt.automation.operations.DscNodeConfigurationOperations - :ivar hybrid_runbook_workers: HybridRunbookWorkersOperations operations - :vartype hybrid_runbook_workers: - azure.mgmt.automation.operations.HybridRunbookWorkersOperations :ivar hybrid_runbook_worker_group: HybridRunbookWorkerGroupOperations operations :vartype hybrid_runbook_worker_group: azure.mgmt.automation.operations.HybridRunbookWorkerGroupOperations - :ivar job: JobOperations operations - :vartype job: azure.mgmt.automation.operations.JobOperations - :ivar job_stream: JobStreamOperations operations - :vartype job_stream: azure.mgmt.automation.operations.JobStreamOperations :ivar job_schedule: JobScheduleOperations operations :vartype job_schedule: azure.mgmt.automation.operations.JobScheduleOperations :ivar linked_workspace: LinkedWorkspaceOperations operations @@ -152,29 +107,24 @@ class AutomationClient( :vartype object_data_types: azure.mgmt.automation.operations.ObjectDataTypesOperations :ivar fields: FieldsOperations operations :vartype fields: azure.mgmt.automation.operations.FieldsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.automation.operations.Operations - :ivar python2_package: Python2PackageOperations operations - :vartype python2_package: azure.mgmt.automation.operations.Python2PackageOperations - :ivar python3_package: Python3PackageOperations operations - :vartype python3_package: azure.mgmt.automation.operations.Python3PackageOperations - :ivar runbook_draft: RunbookDraftOperations operations - :vartype runbook_draft: azure.mgmt.automation.operations.RunbookDraftOperations - :ivar runbook: RunbookOperations operations - :vartype runbook: azure.mgmt.automation.operations.RunbookOperations - :ivar test_job_streams: TestJobStreamsOperations operations - :vartype test_job_streams: azure.mgmt.automation.operations.TestJobStreamsOperations - :ivar test_job: TestJobOperations operations - :vartype test_job: azure.mgmt.automation.operations.TestJobOperations :ivar schedule: ScheduleOperations operations :vartype schedule: azure.mgmt.automation.operations.ScheduleOperations + :ivar variable: VariableOperations operations + :vartype variable: azure.mgmt.automation.operations.VariableOperations + :ivar webhook: WebhookOperations operations + :vartype webhook: azure.mgmt.automation.operations.WebhookOperations + :ivar watcher: WatcherOperations operations + :vartype watcher: azure.mgmt.automation.operations.WatcherOperations + :ivar software_update_configurations: SoftwareUpdateConfigurationsOperations operations + :vartype software_update_configurations: + azure.mgmt.automation.operations.SoftwareUpdateConfigurationsOperations + :ivar software_update_configuration_runs: SoftwareUpdateConfigurationRunsOperations operations + :vartype software_update_configuration_runs: + azure.mgmt.automation.operations.SoftwareUpdateConfigurationRunsOperations :ivar software_update_configuration_machine_runs: SoftwareUpdateConfigurationMachineRunsOperations operations :vartype software_update_configuration_machine_runs: azure.mgmt.automation.operations.SoftwareUpdateConfigurationMachineRunsOperations - :ivar software_update_configuration_runs: SoftwareUpdateConfigurationRunsOperations operations - :vartype software_update_configuration_runs: - azure.mgmt.automation.operations.SoftwareUpdateConfigurationRunsOperations :ivar source_control: SourceControlOperations operations :vartype source_control: azure.mgmt.automation.operations.SourceControlOperations :ivar source_control_sync_job: SourceControlSyncJobOperations operations @@ -183,15 +133,48 @@ class AutomationClient( :ivar source_control_sync_job_streams: SourceControlSyncJobStreamsOperations operations :vartype source_control_sync_job_streams: azure.mgmt.automation.operations.SourceControlSyncJobStreamsOperations - :ivar variable: VariableOperations operations - :vartype variable: azure.mgmt.automation.operations.VariableOperations + :ivar job: JobOperations operations + :vartype job: azure.mgmt.automation.operations.JobOperations + :ivar job_stream: JobStreamOperations operations + :vartype job_stream: azure.mgmt.automation.operations.JobStreamOperations + :ivar agent_registration_information: AgentRegistrationInformationOperations operations + :vartype agent_registration_information: + azure.mgmt.automation.operations.AgentRegistrationInformationOperations + :ivar dsc_node: DscNodeOperations operations + :vartype dsc_node: azure.mgmt.automation.operations.DscNodeOperations + :ivar node_reports: NodeReportsOperations operations + :vartype node_reports: azure.mgmt.automation.operations.NodeReportsOperations + :ivar dsc_compilation_job: DscCompilationJobOperations operations + :vartype dsc_compilation_job: azure.mgmt.automation.operations.DscCompilationJobOperations + :ivar dsc_compilation_job_stream: DscCompilationJobStreamOperations operations + :vartype dsc_compilation_job_stream: + azure.mgmt.automation.operations.DscCompilationJobStreamOperations + :ivar dsc_node_configuration: DscNodeConfigurationOperations operations + :vartype dsc_node_configuration: + azure.mgmt.automation.operations.DscNodeConfigurationOperations + :ivar node_count_information: NodeCountInformationOperations operations + :vartype node_count_information: + azure.mgmt.automation.operations.NodeCountInformationOperations + :ivar runbook_draft: RunbookDraftOperations operations + :vartype runbook_draft: azure.mgmt.automation.operations.RunbookDraftOperations + :ivar runbook: RunbookOperations operations + :vartype runbook: azure.mgmt.automation.operations.RunbookOperations + :ivar test_job_streams: TestJobStreamsOperations operations + :vartype test_job_streams: azure.mgmt.automation.operations.TestJobStreamsOperations + :ivar test_job: TestJobOperations operations + :vartype test_job: azure.mgmt.automation.operations.TestJobOperations + :ivar python2_package: Python2PackageOperations operations + :vartype python2_package: azure.mgmt.automation.operations.Python2PackageOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Gets subscription credentials which uniquely identify 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". + :param base_url: Service URL. Default value is None. :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -200,10 +183,24 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - self._config = AutomationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = AutomationClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -222,43 +219,16 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.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.agent_registration_information = AgentRegistrationInformationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.dsc_node = DscNodeOperations(self._client, self._config, self._serialize, self._deserialize) - self.node_reports = NodeReportsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dsc_compilation_job = DscCompilationJobOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.dsc_compilation_job_stream = DscCompilationJobStreamOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.node_count_information = NodeCountInformationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.watcher = WatcherOperations(self._client, self._config, self._serialize, self._deserialize) - self.software_update_configurations = SoftwareUpdateConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.webhook = WebhookOperations(self._client, self._config, self._serialize, self._deserialize) - self.deleted_automation_accounts = DeletedAutomationAccountsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.automation_account = AutomationAccountOperations( self._client, self._config, self._serialize, self._deserialize ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.statistics = StatisticsOperations(self._client, self._config, self._serialize, self._deserialize) self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) @@ -269,17 +239,9 @@ def __init__( self.dsc_configuration = DscConfigurationOperations( self._client, self._config, self._serialize, self._deserialize ) - self.dsc_node_configuration = DscNodeConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.hybrid_runbook_workers = HybridRunbookWorkersOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.hybrid_runbook_worker_group = HybridRunbookWorkerGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.job = JobOperations(self._client, self._config, self._serialize, self._deserialize) - self.job_stream = JobStreamOperations(self._client, self._config, self._serialize, self._deserialize) self.job_schedule = JobScheduleOperations(self._client, self._config, self._serialize, self._deserialize) self.linked_workspace = LinkedWorkspaceOperations( self._client, self._config, self._serialize, self._deserialize @@ -290,20 +252,19 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.fields = FieldsOperations(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) - self.runbook_draft = RunbookDraftOperations(self._client, self._config, self._serialize, self._deserialize) - self.runbook = RunbookOperations(self._client, self._config, self._serialize, self._deserialize) - self.test_job_streams = TestJobStreamsOperations(self._client, self._config, self._serialize, self._deserialize) - self.test_job = TestJobOperations(self._client, self._config, self._serialize, self._deserialize) self.schedule = ScheduleOperations(self._client, self._config, self._serialize, self._deserialize) - self.software_update_configuration_machine_runs = SoftwareUpdateConfigurationMachineRunsOperations( + self.variable = VariableOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhook = WebhookOperations(self._client, self._config, self._serialize, self._deserialize) + self.watcher = WatcherOperations(self._client, self._config, self._serialize, self._deserialize) + self.software_update_configurations = SoftwareUpdateConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) self.software_update_configuration_runs = SoftwareUpdateConfigurationRunsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.software_update_configuration_machine_runs = SoftwareUpdateConfigurationMachineRunsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.source_control = SourceControlOperations(self._client, self._config, self._serialize, self._deserialize) self.source_control_sync_job = SourceControlSyncJobOperations( self._client, self._config, self._serialize, self._deserialize @@ -311,7 +272,30 @@ def __init__( self.source_control_sync_job_streams = SourceControlSyncJobStreamsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.variable = VariableOperations(self._client, self._config, self._serialize, self._deserialize) + self.job = JobOperations(self._client, self._config, self._serialize, self._deserialize) + self.job_stream = JobStreamOperations(self._client, self._config, self._serialize, self._deserialize) + self.agent_registration_information = AgentRegistrationInformationOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dsc_node = DscNodeOperations(self._client, self._config, self._serialize, self._deserialize) + self.node_reports = NodeReportsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dsc_compilation_job = DscCompilationJobOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dsc_compilation_job_stream = DscCompilationJobStreamOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dsc_node_configuration = DscNodeConfigurationOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.node_count_information = NodeCountInformationOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.runbook_draft = RunbookDraftOperations(self._client, self._config, self._serialize, self._deserialize) + self.runbook = RunbookOperations(self._client, self._config, self._serialize, self._deserialize) + self.test_job_streams = TestJobStreamsOperations(self._client, self._config, self._serialize, self._deserialize) + self.test_job = TestJobOperations(self._client, self._config, self._serialize, self._deserialize) + self.python2_package = Python2PackageOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_configuration.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_configuration.py index 1c318645d2dd..e9f1d22e2592 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_configuration.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -14,11 +14,11 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class AutomationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class AutomationClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for AutomationClient. Note that all parameters used to create this instance are saved as instance @@ -29,9 +29,18 @@ class AutomationClientConfiguration: # pylint: disable=too-many-instance-attrib :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -39,6 +48,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.cloud_setting = cloud_setting self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-automation/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_patch.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_patch.py index f7dd32510333..49900f6ab120 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_patch.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_patch.py @@ -2,6 +2,7 @@ # 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 diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/__init__.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_serialization.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/serialization.py similarity index 81% rename from sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_serialization.py rename to sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/serialization.py index 8139854b97bb..6da830e0cf4a 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_serialization.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/serialization.py @@ -1,30 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -39,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -48,11 +29,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, - List, - Mapping, ) try: @@ -62,13 +39,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -91,6 +68,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :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. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +91,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -155,6 +134,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -179,80 +163,31 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], 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 +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items 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): @@ -300,13 +242,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -326,7 +278,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -346,12 +302,14 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + 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, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -380,12 +338,15 @@ def my_key_transformer(key, attr_desc, value): 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 :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) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -395,30 +356,31 @@ def _infer_class_models(cls): 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: + except Exception: # pylint: disable=broad-exception-caught # 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: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """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 + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -426,9 +388,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -448,21 +412,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access 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. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ 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) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -501,11 +469,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -540,7 +510,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -556,17 +526,20 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object 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. + :raises SerializationError: if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -592,17 +565,19 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + 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) + serialized |= target_obj.additional_properties continue try: @@ -633,7 +608,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): 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 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 @@ -664,17 +640,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object 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 + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -703,7 +679,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -712,11 +688,13 @@ def body(self, 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 name: The name of the URL path parameter. + :param object 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 + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -728,21 +706,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + 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 name: The name of the query parameter. + :param object 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, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -759,19 +736,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + 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 name: The name of the header. + :param object 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 + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -780,21 +758,20 @@ def header(self, name, data, data_type, **kwargs): 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) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + 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 object 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. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -805,12 +782,12 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if 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__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -821,11 +798,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -841,23 +817,33 @@ def serialize_basic(cls, data, data_type, **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 obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. """ 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 + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) @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. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -871,8 +857,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -882,15 +867,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): 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 list data: 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 + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -945,9 +928,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :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 + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -971,7 +953,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """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 @@ -979,6 +961,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1003,7 +986,7 @@ def serialize_object(self, attr, **kwargs): 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): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1034,56 +1017,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: 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)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1091,11 +1079,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1105,30 +1094,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. + :return: serialized rfc """ 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.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1141,12 +1132,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1172,13 +1164,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """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 + :raises SerializationError: if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1186,17 +1179,17 @@ def serialize_unix(attr, **kwargs): 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.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument 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)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1211,7 +1204,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1232,17 +1227,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, 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.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ 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): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """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" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1279,7 +1286,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1331,22 +1338,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + 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 - ) + # 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. + ) + 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: @@ -1354,7 +1360,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1363,9 +1369,9 @@ class Deserializer(object): 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}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1385,7 +1391,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1401,27 +1407,29 @@ def __call__(self, target_obj, response_data, content_type=None): :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. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """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. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: 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(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1440,13 +1448,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1476,9 +1484,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + 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: @@ -1505,6 +1512,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1516,7 +1525,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1531,10 +1540,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :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. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1552,10 +1563,12 @@ def _unpack_content(raw_data, content_type=None): 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. + :param obj raw_data: Data to be processed. + :param str 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 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1579,24 +1592,35 @@ def _unpack_content(raw_data, content_type=None): 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. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ 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")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + 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 + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1605,15 +1629,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """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. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1627,7 +1652,11 @@ def deserialize_data(self, data, data_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"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "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) @@ -1647,14 +1676,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + 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. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1671,6 +1700,7 @@ def deserialize_dict(self, attr, dict_type): :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. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1681,13 +1711,14 @@ def deserialize_dict(self, attr, dict_type): 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): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1720,11 +1751,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """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 @@ -1732,8 +1762,9 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1743,24 +1774,27 @@ def deserialize_basic(self, attr, data_type): 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 + # 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, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if 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 + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) @staticmethod def deserialize_unicode(data): @@ -1768,6 +1802,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1781,8 +1816,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1794,6 +1828,7 @@ def deserialize_enum(data, enum_obj): :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. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1804,9 +1839,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1822,8 +1857,9 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1834,8 +1870,9 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1849,8 +1886,9 @@ 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. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1865,8 +1903,9 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1877,8 +1916,9 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1887,16 +1927,16 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1910,8 +1950,9 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1924,31 +1965,32 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :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)) + *parsed_date[:6], tzinfo=datetime.timezone(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 DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1976,8 +2018,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1985,8 +2026,9 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore @@ -1996,5 +2038,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_vendor.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_vendor.py deleted file mode 100644 index 36f1cf507c1a..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_vendor.py +++ /dev/null @@ -1,26 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import TYPE_CHECKING - -from ._configuration import AutomationClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import PipelineClient - - from ._serialization import Deserializer, Serializer - - -class AutomationClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "PipelineClient" - _config: AutomationClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" 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 a741dc7b69b5..13fcaff38832 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,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0b4" + +VERSION = "1.0.1" diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/__init__.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/__init__.py index dd297a2db1bb..a019f6ceb932 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/__init__.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._automation_client import AutomationClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._automation_client import AutomationClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "AutomationClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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 a12b29ddef41..19b0af2bb01d 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 @@ -7,27 +7,27 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import AutomationClientConfiguration from .operations import ( ActivityOperations, AgentRegistrationInformationOperations, AutomationAccountOperations, - AutomationClientOperationsMixin, CertificateOperations, ConnectionOperations, ConnectionTypeOperations, CredentialOperations, - DeletedAutomationAccountsOperations, DscCompilationJobOperations, DscCompilationJobStreamOperations, DscConfigurationOperations, @@ -35,7 +35,6 @@ DscNodeOperations, FieldsOperations, HybridRunbookWorkerGroupOperations, - HybridRunbookWorkersOperations, JobOperations, JobScheduleOperations, JobStreamOperations, @@ -46,10 +45,7 @@ NodeReportsOperations, ObjectDataTypesOperations, Operations, - PrivateEndpointConnectionsOperations, - PrivateLinkResourcesOperations, Python2PackageOperations, - Python3PackageOperations, RunbookDraftOperations, RunbookOperations, ScheduleOperations, @@ -69,48 +65,17 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class AutomationClient( - AutomationClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class AutomationClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Automation Client. - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.automation.aio.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.automation.aio.operations.PrivateLinkResourcesOperations - :ivar agent_registration_information: AgentRegistrationInformationOperations operations - :vartype agent_registration_information: - azure.mgmt.automation.aio.operations.AgentRegistrationInformationOperations - :ivar dsc_node: DscNodeOperations operations - :vartype dsc_node: azure.mgmt.automation.aio.operations.DscNodeOperations - :ivar node_reports: NodeReportsOperations operations - :vartype node_reports: azure.mgmt.automation.aio.operations.NodeReportsOperations - :ivar dsc_compilation_job: DscCompilationJobOperations operations - :vartype dsc_compilation_job: azure.mgmt.automation.aio.operations.DscCompilationJobOperations - :ivar dsc_compilation_job_stream: DscCompilationJobStreamOperations operations - :vartype dsc_compilation_job_stream: - azure.mgmt.automation.aio.operations.DscCompilationJobStreamOperations - :ivar node_count_information: NodeCountInformationOperations operations - :vartype node_count_information: - azure.mgmt.automation.aio.operations.NodeCountInformationOperations - :ivar watcher: WatcherOperations operations - :vartype watcher: azure.mgmt.automation.aio.operations.WatcherOperations - :ivar software_update_configurations: SoftwareUpdateConfigurationsOperations operations - :vartype software_update_configurations: - azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationsOperations - :ivar webhook: WebhookOperations operations - :vartype webhook: azure.mgmt.automation.aio.operations.WebhookOperations - :ivar deleted_automation_accounts: DeletedAutomationAccountsOperations operations - :vartype deleted_automation_accounts: - azure.mgmt.automation.aio.operations.DeletedAutomationAccountsOperations :ivar automation_account: AutomationAccountOperations operations :vartype automation_account: azure.mgmt.automation.aio.operations.AutomationAccountOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.automation.aio.operations.Operations :ivar statistics: StatisticsOperations operations :vartype statistics: azure.mgmt.automation.aio.operations.StatisticsOperations :ivar usages: UsagesOperations operations @@ -127,19 +92,9 @@ class AutomationClient( :vartype credential: azure.mgmt.automation.aio.operations.CredentialOperations :ivar dsc_configuration: DscConfigurationOperations operations :vartype dsc_configuration: azure.mgmt.automation.aio.operations.DscConfigurationOperations - :ivar dsc_node_configuration: DscNodeConfigurationOperations operations - :vartype dsc_node_configuration: - azure.mgmt.automation.aio.operations.DscNodeConfigurationOperations - :ivar hybrid_runbook_workers: HybridRunbookWorkersOperations operations - :vartype hybrid_runbook_workers: - azure.mgmt.automation.aio.operations.HybridRunbookWorkersOperations :ivar hybrid_runbook_worker_group: HybridRunbookWorkerGroupOperations operations :vartype hybrid_runbook_worker_group: azure.mgmt.automation.aio.operations.HybridRunbookWorkerGroupOperations - :ivar job: JobOperations operations - :vartype job: azure.mgmt.automation.aio.operations.JobOperations - :ivar job_stream: JobStreamOperations operations - :vartype job_stream: azure.mgmt.automation.aio.operations.JobStreamOperations :ivar job_schedule: JobScheduleOperations operations :vartype job_schedule: azure.mgmt.automation.aio.operations.JobScheduleOperations :ivar linked_workspace: LinkedWorkspaceOperations operations @@ -152,29 +107,24 @@ 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 operations: Operations operations - :vartype operations: azure.mgmt.automation.aio.operations.Operations - :ivar python2_package: Python2PackageOperations operations - :vartype python2_package: azure.mgmt.automation.aio.operations.Python2PackageOperations - :ivar python3_package: Python3PackageOperations operations - :vartype python3_package: azure.mgmt.automation.aio.operations.Python3PackageOperations - :ivar runbook_draft: RunbookDraftOperations operations - :vartype runbook_draft: azure.mgmt.automation.aio.operations.RunbookDraftOperations - :ivar runbook: RunbookOperations operations - :vartype runbook: azure.mgmt.automation.aio.operations.RunbookOperations - :ivar test_job_streams: TestJobStreamsOperations operations - :vartype test_job_streams: azure.mgmt.automation.aio.operations.TestJobStreamsOperations - :ivar test_job: TestJobOperations operations - :vartype test_job: azure.mgmt.automation.aio.operations.TestJobOperations :ivar schedule: ScheduleOperations operations :vartype schedule: azure.mgmt.automation.aio.operations.ScheduleOperations + :ivar variable: VariableOperations operations + :vartype variable: azure.mgmt.automation.aio.operations.VariableOperations + :ivar webhook: WebhookOperations operations + :vartype webhook: azure.mgmt.automation.aio.operations.WebhookOperations + :ivar watcher: WatcherOperations operations + :vartype watcher: azure.mgmt.automation.aio.operations.WatcherOperations + :ivar software_update_configurations: SoftwareUpdateConfigurationsOperations operations + :vartype software_update_configurations: + azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationsOperations + :ivar software_update_configuration_runs: SoftwareUpdateConfigurationRunsOperations operations + :vartype software_update_configuration_runs: + azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationRunsOperations :ivar software_update_configuration_machine_runs: SoftwareUpdateConfigurationMachineRunsOperations operations :vartype software_update_configuration_machine_runs: azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationMachineRunsOperations - :ivar software_update_configuration_runs: SoftwareUpdateConfigurationRunsOperations operations - :vartype software_update_configuration_runs: - azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationRunsOperations :ivar source_control: SourceControlOperations operations :vartype source_control: azure.mgmt.automation.aio.operations.SourceControlOperations :ivar source_control_sync_job: SourceControlSyncJobOperations operations @@ -183,15 +133,48 @@ class AutomationClient( :ivar source_control_sync_job_streams: SourceControlSyncJobStreamsOperations operations :vartype source_control_sync_job_streams: azure.mgmt.automation.aio.operations.SourceControlSyncJobStreamsOperations - :ivar variable: VariableOperations operations - :vartype variable: azure.mgmt.automation.aio.operations.VariableOperations + :ivar job: JobOperations operations + :vartype job: azure.mgmt.automation.aio.operations.JobOperations + :ivar job_stream: JobStreamOperations operations + :vartype job_stream: azure.mgmt.automation.aio.operations.JobStreamOperations + :ivar agent_registration_information: AgentRegistrationInformationOperations operations + :vartype agent_registration_information: + azure.mgmt.automation.aio.operations.AgentRegistrationInformationOperations + :ivar dsc_node: DscNodeOperations operations + :vartype dsc_node: azure.mgmt.automation.aio.operations.DscNodeOperations + :ivar node_reports: NodeReportsOperations operations + :vartype node_reports: azure.mgmt.automation.aio.operations.NodeReportsOperations + :ivar dsc_compilation_job: DscCompilationJobOperations operations + :vartype dsc_compilation_job: azure.mgmt.automation.aio.operations.DscCompilationJobOperations + :ivar dsc_compilation_job_stream: DscCompilationJobStreamOperations operations + :vartype dsc_compilation_job_stream: + azure.mgmt.automation.aio.operations.DscCompilationJobStreamOperations + :ivar dsc_node_configuration: DscNodeConfigurationOperations operations + :vartype dsc_node_configuration: + azure.mgmt.automation.aio.operations.DscNodeConfigurationOperations + :ivar node_count_information: NodeCountInformationOperations operations + :vartype node_count_information: + azure.mgmt.automation.aio.operations.NodeCountInformationOperations + :ivar runbook_draft: RunbookDraftOperations operations + :vartype runbook_draft: azure.mgmt.automation.aio.operations.RunbookDraftOperations + :ivar runbook: RunbookOperations operations + :vartype runbook: azure.mgmt.automation.aio.operations.RunbookOperations + :ivar test_job_streams: TestJobStreamsOperations operations + :vartype test_job_streams: azure.mgmt.automation.aio.operations.TestJobStreamsOperations + :ivar test_job: TestJobOperations operations + :vartype test_job: azure.mgmt.automation.aio.operations.TestJobOperations + :ivar python2_package: Python2PackageOperations operations + :vartype python2_package: azure.mgmt.automation.aio.operations.Python2PackageOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Gets subscription credentials which uniquely identify 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". + :param base_url: Service URL. Default value is None. :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -200,10 +183,24 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - self._config = AutomationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = AutomationClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -222,43 +219,18 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.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.agent_registration_information = AgentRegistrationInformationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.dsc_node = DscNodeOperations(self._client, self._config, self._serialize, self._deserialize) - self.node_reports = NodeReportsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dsc_compilation_job = DscCompilationJobOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.dsc_compilation_job_stream = DscCompilationJobStreamOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.node_count_information = NodeCountInformationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.watcher = WatcherOperations(self._client, self._config, self._serialize, self._deserialize) - self.software_update_configurations = SoftwareUpdateConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.webhook = WebhookOperations(self._client, self._config, self._serialize, self._deserialize) - self.deleted_automation_accounts = DeletedAutomationAccountsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.automation_account = AutomationAccountOperations( self._client, self._config, self._serialize, self._deserialize ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.statistics = StatisticsOperations(self._client, self._config, self._serialize, self._deserialize) self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) @@ -269,17 +241,9 @@ def __init__( self.dsc_configuration = DscConfigurationOperations( self._client, self._config, self._serialize, self._deserialize ) - self.dsc_node_configuration = DscNodeConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.hybrid_runbook_workers = HybridRunbookWorkersOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.hybrid_runbook_worker_group = HybridRunbookWorkerGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.job = JobOperations(self._client, self._config, self._serialize, self._deserialize) - self.job_stream = JobStreamOperations(self._client, self._config, self._serialize, self._deserialize) self.job_schedule = JobScheduleOperations(self._client, self._config, self._serialize, self._deserialize) self.linked_workspace = LinkedWorkspaceOperations( self._client, self._config, self._serialize, self._deserialize @@ -290,20 +254,19 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.fields = FieldsOperations(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) - self.runbook_draft = RunbookDraftOperations(self._client, self._config, self._serialize, self._deserialize) - self.runbook = RunbookOperations(self._client, self._config, self._serialize, self._deserialize) - self.test_job_streams = TestJobStreamsOperations(self._client, self._config, self._serialize, self._deserialize) - self.test_job = TestJobOperations(self._client, self._config, self._serialize, self._deserialize) self.schedule = ScheduleOperations(self._client, self._config, self._serialize, self._deserialize) - self.software_update_configuration_machine_runs = SoftwareUpdateConfigurationMachineRunsOperations( + self.variable = VariableOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhook = WebhookOperations(self._client, self._config, self._serialize, self._deserialize) + self.watcher = WatcherOperations(self._client, self._config, self._serialize, self._deserialize) + self.software_update_configurations = SoftwareUpdateConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) self.software_update_configuration_runs = SoftwareUpdateConfigurationRunsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.software_update_configuration_machine_runs = SoftwareUpdateConfigurationMachineRunsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.source_control = SourceControlOperations(self._client, self._config, self._serialize, self._deserialize) self.source_control_sync_job = SourceControlSyncJobOperations( self._client, self._config, self._serialize, self._deserialize @@ -311,7 +274,30 @@ def __init__( self.source_control_sync_job_streams = SourceControlSyncJobStreamsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.variable = VariableOperations(self._client, self._config, self._serialize, self._deserialize) + self.job = JobOperations(self._client, self._config, self._serialize, self._deserialize) + self.job_stream = JobStreamOperations(self._client, self._config, self._serialize, self._deserialize) + self.agent_registration_information = AgentRegistrationInformationOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dsc_node = DscNodeOperations(self._client, self._config, self._serialize, self._deserialize) + self.node_reports = NodeReportsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dsc_compilation_job = DscCompilationJobOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dsc_compilation_job_stream = DscCompilationJobStreamOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dsc_node_configuration = DscNodeConfigurationOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.node_count_information = NodeCountInformationOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.runbook_draft = RunbookDraftOperations(self._client, self._config, self._serialize, self._deserialize) + self.runbook = RunbookOperations(self._client, self._config, self._serialize, self._deserialize) + self.test_job_streams = TestJobStreamsOperations(self._client, self._config, self._serialize, self._deserialize) + self.test_job = TestJobOperations(self._client, self._config, self._serialize, self._deserialize) + self.python2_package = Python2PackageOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_configuration.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_configuration.py index e646eef1aee2..2e88f37b00e1 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_configuration.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -14,11 +14,11 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class AutomationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class AutomationClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for AutomationClient. Note that all parameters used to create this instance are saved as instance @@ -29,9 +29,18 @@ class AutomationClientConfiguration: # pylint: disable=too-many-instance-attrib :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -39,6 +48,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.cloud_setting = cloud_setting self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-automation/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_patch.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_patch.py index f7dd32510333..49900f6ab120 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_patch.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_patch.py @@ -2,6 +2,7 @@ # 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 diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_vendor.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_vendor.py deleted file mode 100644 index 275e83ccb7e0..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_vendor.py +++ /dev/null @@ -1,26 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import TYPE_CHECKING - -from ._configuration import AutomationClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import AsyncPipelineClient - - from .._serialization import Deserializer, Serializer - - -class AutomationClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "AsyncPipelineClient" - _config: AutomationClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" 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..e63de9f02ba2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,73 +6,62 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._agent_registration_information_operations import AgentRegistrationInformationOperations -from ._dsc_node_operations import DscNodeOperations -from ._node_reports_operations import NodeReportsOperations -from ._dsc_compilation_job_operations import DscCompilationJobOperations -from ._dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations -from ._node_count_information_operations import NodeCountInformationOperations -from ._watcher_operations import WatcherOperations -from ._software_update_configurations_operations import SoftwareUpdateConfigurationsOperations -from ._webhook_operations import WebhookOperations -from ._deleted_automation_accounts_operations import DeletedAutomationAccountsOperations -from ._automation_account_operations import AutomationAccountOperations -from ._statistics_operations import StatisticsOperations -from ._usages_operations import UsagesOperations -from ._keys_operations import KeysOperations -from ._certificate_operations import CertificateOperations -from ._connection_operations import ConnectionOperations -from ._connection_type_operations import ConnectionTypeOperations -from ._credential_operations import CredentialOperations -from ._dsc_configuration_operations import DscConfigurationOperations -from ._dsc_node_configuration_operations import DscNodeConfigurationOperations -from ._hybrid_runbook_workers_operations import HybridRunbookWorkersOperations -from ._hybrid_runbook_worker_group_operations import HybridRunbookWorkerGroupOperations -from ._job_operations import JobOperations -from ._job_stream_operations import JobStreamOperations -from ._job_schedule_operations import JobScheduleOperations -from ._linked_workspace_operations import LinkedWorkspaceOperations -from ._activity_operations import ActivityOperations -from ._module_operations import ModuleOperations -from ._object_data_types_operations import ObjectDataTypesOperations -from ._fields_operations import FieldsOperations -from ._operations import Operations -from ._automation_client_operations import AutomationClientOperationsMixin -from ._python2_package_operations import Python2PackageOperations -from ._python3_package_operations import Python3PackageOperations -from ._runbook_draft_operations import RunbookDraftOperations -from ._runbook_operations import RunbookOperations -from ._test_job_streams_operations import TestJobStreamsOperations -from ._test_job_operations import TestJobOperations -from ._schedule_operations import ScheduleOperations -from ._software_update_configuration_machine_runs_operations import SoftwareUpdateConfigurationMachineRunsOperations -from ._software_update_configuration_runs_operations import SoftwareUpdateConfigurationRunsOperations -from ._source_control_operations import SourceControlOperations -from ._source_control_sync_job_operations import SourceControlSyncJobOperations -from ._source_control_sync_job_streams_operations import SourceControlSyncJobStreamsOperations -from ._variable_operations import VariableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._automation_account_operations import AutomationAccountOperations # type: ignore +from ._operations import Operations # type: ignore +from ._statistics_operations import StatisticsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._keys_operations import KeysOperations # type: ignore +from ._certificate_operations import CertificateOperations # type: ignore +from ._connection_operations import ConnectionOperations # type: ignore +from ._connection_type_operations import ConnectionTypeOperations # type: ignore +from ._credential_operations import CredentialOperations # type: ignore +from ._dsc_configuration_operations import DscConfigurationOperations # type: ignore +from ._hybrid_runbook_worker_group_operations import HybridRunbookWorkerGroupOperations # type: ignore +from ._job_schedule_operations import JobScheduleOperations # type: ignore +from ._linked_workspace_operations import LinkedWorkspaceOperations # type: ignore +from ._activity_operations import ActivityOperations # type: ignore +from ._module_operations import ModuleOperations # type: ignore +from ._object_data_types_operations import ObjectDataTypesOperations # type: ignore +from ._fields_operations import FieldsOperations # type: ignore +from ._schedule_operations import ScheduleOperations # type: ignore +from ._variable_operations import VariableOperations # type: ignore +from ._webhook_operations import WebhookOperations # type: ignore +from ._watcher_operations import WatcherOperations # type: ignore +from ._software_update_configurations_operations import SoftwareUpdateConfigurationsOperations # type: ignore +from ._software_update_configuration_runs_operations import SoftwareUpdateConfigurationRunsOperations # type: ignore +from ._software_update_configuration_machine_runs_operations import SoftwareUpdateConfigurationMachineRunsOperations # type: ignore +from ._source_control_operations import SourceControlOperations # type: ignore +from ._source_control_sync_job_operations import SourceControlSyncJobOperations # type: ignore +from ._source_control_sync_job_streams_operations import SourceControlSyncJobStreamsOperations # type: ignore +from ._job_operations import JobOperations # type: ignore +from ._job_stream_operations import JobStreamOperations # type: ignore +from ._agent_registration_information_operations import AgentRegistrationInformationOperations # type: ignore +from ._dsc_node_operations import DscNodeOperations # type: ignore +from ._node_reports_operations import NodeReportsOperations # type: ignore +from ._dsc_compilation_job_operations import DscCompilationJobOperations # type: ignore +from ._dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations # type: ignore +from ._dsc_node_configuration_operations import DscNodeConfigurationOperations # type: ignore +from ._node_count_information_operations import NodeCountInformationOperations # type: ignore +from ._runbook_draft_operations import RunbookDraftOperations # type: ignore +from ._runbook_operations import RunbookOperations # type: ignore +from ._test_job_streams_operations import TestJobStreamsOperations # type: ignore +from ._test_job_operations import TestJobOperations # type: ignore +from ._python2_package_operations import Python2PackageOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "PrivateEndpointConnectionsOperations", - "PrivateLinkResourcesOperations", - "AgentRegistrationInformationOperations", - "DscNodeOperations", - "NodeReportsOperations", - "DscCompilationJobOperations", - "DscCompilationJobStreamOperations", - "NodeCountInformationOperations", - "WatcherOperations", - "SoftwareUpdateConfigurationsOperations", - "WebhookOperations", - "DeletedAutomationAccountsOperations", "AutomationAccountOperations", + "Operations", "StatisticsOperations", "UsagesOperations", "KeysOperations", @@ -80,32 +70,37 @@ "ConnectionTypeOperations", "CredentialOperations", "DscConfigurationOperations", - "DscNodeConfigurationOperations", - "HybridRunbookWorkersOperations", "HybridRunbookWorkerGroupOperations", - "JobOperations", - "JobStreamOperations", "JobScheduleOperations", "LinkedWorkspaceOperations", "ActivityOperations", "ModuleOperations", "ObjectDataTypesOperations", "FieldsOperations", - "Operations", - "AutomationClientOperationsMixin", - "Python2PackageOperations", - "Python3PackageOperations", - "RunbookDraftOperations", - "RunbookOperations", - "TestJobStreamsOperations", - "TestJobOperations", "ScheduleOperations", - "SoftwareUpdateConfigurationMachineRunsOperations", + "VariableOperations", + "WebhookOperations", + "WatcherOperations", + "SoftwareUpdateConfigurationsOperations", "SoftwareUpdateConfigurationRunsOperations", + "SoftwareUpdateConfigurationMachineRunsOperations", "SourceControlOperations", "SourceControlSyncJobOperations", "SourceControlSyncJobStreamsOperations", - "VariableOperations", + "JobOperations", + "JobStreamOperations", + "AgentRegistrationInformationOperations", + "DscNodeOperations", + "NodeReportsOperations", + "DscCompilationJobOperations", + "DscCompilationJobStreamOperations", + "DscNodeConfigurationOperations", + "NodeCountInformationOperations", + "RunbookDraftOperations", + "RunbookOperations", + "TestJobStreamsOperations", + "TestJobOperations", + "Python2PackageOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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 eab8810e54b9..7d972fd180d6 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,14 +26,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._activity_operations import build_get_request, build_list_by_module_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ActivityOperations: @@ -50,10 +49,10 @@ class ActivityOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -81,7 +80,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.Activity :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,7 +91,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Activity] = kwargs.pop("cls", None) _request = build_get_request( @@ -116,7 +115,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Activity", pipeline_response.http_response) @@ -129,7 +131,7 @@ async def get( @distributed_trace def list_by_module( self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Activity"]: + ) -> AsyncItemPaged["_models.Activity"]: """Retrieve a list of activities in the module identified by module name. .. seealso:: @@ -148,10 +150,10 @@ def list_by_module( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.ActivityListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +199,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 564d0552c687..7aa1f3cd79a8 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,14 +25,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._agent_registration_information_operations import build_get_request, build_regenerate_key_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class AgentRegistrationInformationOperations: @@ -49,10 +48,10 @@ class AgentRegistrationInformationOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -71,7 +70,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.AgentRegistration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -82,7 +81,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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) _request = build_get_request( @@ -104,7 +103,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("AgentRegistration", pipeline_response.http_response) @@ -197,7 +199,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.automation.models.AgentRegistration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +210,7 @@ async def regenerate_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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) @@ -242,7 +244,10 @@ async def regenerate_key( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("AgentRegistration", 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 bc619402d3fb..f87af3b6d17e 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._automation_account_operations import ( build_create_or_update_request, build_delete_request, @@ -35,13 +36,11 @@ build_list_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class AutomationAccountOperations: @@ -58,10 +57,10 @@ class AutomationAccountOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def update( @@ -145,7 +144,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.AutomationAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -156,7 +155,7 @@ async def 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-08-08")) + 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.AutomationAccount] = kwargs.pop("cls", None) @@ -190,7 +189,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("AutomationAccount", pipeline_response.http_response) @@ -283,7 +285,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.AutomationAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -294,7 +296,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", "2022-08-08")) + 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.AutomationAccount] = kwargs.pop("cls", None) @@ -328,7 +330,10 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("AutomationAccount", pipeline_response.http_response) @@ -339,9 +344,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> None: """Delete an automation account. .. seealso:: @@ -355,7 +358,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -366,7 +369,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", "2022-08-08")) + 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( @@ -388,7 +391,10 @@ async def delete( # pylint: disable=inconsistent-return-statements 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -411,7 +417,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.AutomationAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -422,7 +428,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) _request = build_get_request( @@ -444,7 +450,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("AutomationAccount", pipeline_response.http_response) @@ -457,7 +466,7 @@ async def get( @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AutomationAccount"]: + ) -> AsyncItemPaged["_models.AutomationAccount"]: """Retrieve a list of accounts within a given resource group. .. seealso:: @@ -473,10 +482,10 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.AutomationAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -520,7 +529,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -528,7 +540,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.AutomationAccount"]: + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.AutomationAccount"]: """Lists the Automation Accounts within an Azure subscription. Retrieve a list of accounts within a given subscription. @@ -541,10 +553,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AutomationAccount"]: _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.AutomationAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -587,7 +599,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 deleted file mode 100644 index 201b4d34c99e..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_client_operations.py +++ /dev/null @@ -1,167 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._automation_client_operations import build_convert_graph_runbook_content_request -from .._vendor import AutomationClientMixinABC - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AutomationClientOperationsMixin(AutomationClientMixinABC): - - @overload - async def convert_graph_runbook_content( - self, - resource_group_name: str, - automation_account_name: str, - parameters: _models.GraphicalRunbookContent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GraphicalRunbookContent: - """Post operation to serialize or deserialize GraphRunbookContent. - - :param resource_group_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: Input data describing the graphical runbook. Required. - :type parameters: ~azure.mgmt.automation.models.GraphicalRunbookContent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: GraphicalRunbookContent or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.GraphicalRunbookContent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def convert_graph_runbook_content( - self, - resource_group_name: str, - automation_account_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GraphicalRunbookContent: - """Post operation to serialize or deserialize GraphRunbookContent. - - :param resource_group_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: Input data describing the graphical runbook. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: GraphicalRunbookContent or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.GraphicalRunbookContent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def convert_graph_runbook_content( - self, - resource_group_name: str, - automation_account_name: str, - parameters: Union[_models.GraphicalRunbookContent, IO[bytes]], - **kwargs: Any - ) -> _models.GraphicalRunbookContent: - """Post operation to serialize or deserialize GraphRunbookContent. - - :param resource_group_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: Input data describing the graphical runbook. Is either a - GraphicalRunbookContent type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.GraphicalRunbookContent or IO[bytes] - :return: GraphicalRunbookContent or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.GraphicalRunbookContent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - 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, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "GraphicalRunbookContent") - - _request = build_convert_graph_runbook_content_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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("GraphicalRunbookContent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore 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 7cc02325d85b..58c0c65179c4 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._certificate_operations import ( build_create_or_update_request, build_delete_request, @@ -34,13 +35,11 @@ build_list_by_automation_account_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class CertificateOperations: @@ -57,13 +56,13 @@ class CertificateOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, certificate_name: str, **kwargs: Any ) -> None: """Delete the certificate. @@ -81,7 +80,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + 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( @@ -115,7 +114,10 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -140,7 +142,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -151,7 +153,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) _request = build_get_request( @@ -174,7 +176,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Certificate", pipeline_response.http_response) @@ -281,7 +286,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -292,7 +297,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", "2022-08-08")) + 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.Certificate] = kwargs.pop("cls", None) @@ -327,7 +332,10 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Certificate", pipeline_response.http_response) @@ -428,7 +436,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +447,7 @@ async def 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-08-08")) + 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.Certificate] = kwargs.pop("cls", None) @@ -474,7 +482,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Certificate", pipeline_response.http_response) @@ -487,7 +498,7 @@ async def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Certificate"]: + ) -> AsyncItemPaged["_models.Certificate"]: """Retrieve a list of certificates. .. seealso:: @@ -504,10 +515,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.CertificateListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -552,7 +563,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 b6574d8f02f3..e5a102438897 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._connection_operations import ( build_create_or_update_request, build_delete_request, @@ -34,13 +35,11 @@ build_list_by_automation_account_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ConnectionOperations: @@ -57,15 +56,15 @@ class ConnectionOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, connection_name: str, **kwargs: Any - ) -> None: + ) -> Optional[_models.Connection]: """Delete the connection. .. seealso:: @@ -77,11 +76,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type automation_account_name: str :param connection_name: The name of connection. Required. :type connection_name: str - :return: None or the result of cls(response) - :rtype: None + :return: Connection or None or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Connection or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,8 +91,8 @@ 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", "2022-08-08")) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + cls: ClsType[Optional[_models.Connection]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -115,11 +114,20 @@ async def delete( # pylint: disable=inconsistent-return-statements 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) + 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("Connection", pipeline_response.http_response) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def get( @@ -140,7 +148,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.Connection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -151,7 +159,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) _request = build_get_request( @@ -174,7 +182,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Connection", pipeline_response.http_response) @@ -280,7 +291,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.Connection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -291,7 +302,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", "2022-08-08")) + 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.Connection] = kwargs.pop("cls", None) @@ -326,7 +337,10 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Connection", pipeline_response.http_response) @@ -427,7 +441,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.Connection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -438,7 +452,7 @@ async def 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-08-08")) + 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.Connection] = kwargs.pop("cls", None) @@ -473,7 +487,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Connection", pipeline_response.http_response) @@ -486,7 +503,7 @@ async def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Connection"]: + ) -> AsyncItemPaged["_models.Connection"]: """Retrieve a list of connections. .. seealso:: @@ -503,10 +520,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.ConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -551,7 +568,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 ed99e229ea26..605f84e5c4a6 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,19 +27,18 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._connection_type_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ConnectionTypeOperations: @@ -56,13 +55,13 @@ class ConnectionTypeOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, connection_type_name: str, **kwargs: Any ) -> None: """Delete the connection type. @@ -80,7 +79,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + 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( @@ -114,7 +113,10 @@ async def delete( # pylint: disable=inconsistent-return-statements 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -139,7 +141,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.ConnectionType :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -150,7 +152,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) _request = build_get_request( @@ -173,7 +175,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ConnectionType", pipeline_response.http_response) @@ -280,7 +285,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.ConnectionType :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -291,7 +296,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", "2022-08-08")) + 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.ConnectionType] = kwargs.pop("cls", None) @@ -324,9 +329,12 @@ async def create_or_update( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [201, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ConnectionType", pipeline_response.http_response) @@ -339,7 +347,7 @@ async def create_or_update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConnectionType"]: + ) -> AsyncItemPaged["_models.ConnectionType"]: """Retrieve a list of connection types. .. seealso:: @@ -356,10 +364,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.ConnectionTypeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -404,7 +412,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 179c573a20b4..7ef49e55641b 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._credential_operations import ( build_create_or_update_request, build_delete_request, @@ -34,13 +35,11 @@ build_list_by_automation_account_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class CredentialOperations: @@ -57,13 +56,13 @@ class CredentialOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, credential_name: str, **kwargs: Any ) -> None: """Delete the credential. @@ -81,7 +80,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + 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( @@ -115,7 +114,10 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -140,7 +142,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.Credential :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -151,7 +153,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) _request = build_get_request( @@ -174,7 +176,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Credential", pipeline_response.http_response) @@ -280,7 +285,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.Credential :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -291,7 +296,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", "2022-08-08")) + 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.Credential] = kwargs.pop("cls", None) @@ -326,7 +331,10 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Credential", pipeline_response.http_response) @@ -427,7 +435,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.Credential :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -438,7 +446,7 @@ async def 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-08-08")) + 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.Credential] = kwargs.pop("cls", None) @@ -473,7 +481,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Credential", pipeline_response.http_response) @@ -486,7 +497,7 @@ async def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Credential"]: + ) -> AsyncItemPaged["_models.Credential"]: """Retrieve a list of credentials. .. seealso:: @@ -503,10 +514,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.CredentialListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 deleted file mode 100644 index ba4c397021c2..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_deleted_automation_accounts_operations.py +++ /dev/null @@ -1,103 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._deleted_automation_accounts_operations import build_list_by_subscription_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeletedAutomationAccountsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`deleted_automation_accounts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = 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_by_subscription(self, **kwargs: Any) -> _models.DeletedAutomationAccountListResult: - """Retrieve deleted automation account. - - :return: DeletedAutomationAccountListResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DeletedAutomationAccountListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-31")) - cls: ClsType[_models.DeletedAutomationAccountListResult] = kwargs.pop("cls", None) - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeletedAutomationAccountListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore 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 94825d144c08..5b3f694a5355 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,19 +31,18 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._dsc_compilation_job_operations import ( build_create_request, build_get_request, build_get_stream_request, build_list_by_automation_account_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class DscCompilationJobOperations: @@ -60,10 +59,10 @@ class DscCompilationJobOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def _create_initial( self, @@ -73,7 +72,7 @@ async def _create_initial( parameters: Union[_models.DscCompilationJobCreateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,7 +83,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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) @@ -124,7 +123,10 @@ async def _create_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -231,7 +233,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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) 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) @@ -295,7 +297,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.DscCompilationJob :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +308,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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) _request = build_get_request( @@ -329,7 +331,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscCompilationJob", pipeline_response.http_response) @@ -342,7 +347,7 @@ async def get( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.DscCompilationJob"]: + ) -> AsyncItemPaged["_models.DscCompilationJob"]: """Retrieve a list of dsc compilation jobs. .. seealso:: @@ -362,10 +367,10 @@ def list_by_automation_account( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscCompilationJobListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +416,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -439,7 +447,7 @@ async def get_stream( :rtype: ~azure.mgmt.automation.models.JobStream :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -450,7 +458,7 @@ async def get_stream( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) _request = build_get_stream_request( @@ -474,7 +482,10 @@ async def get_stream( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("JobStream", 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 f56ebe0fc155..7738f463bc32 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code 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, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,14 +24,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._dsc_compilation_job_stream_operations import build_list_by_job_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class DscCompilationJobStreamOperations: @@ -48,10 +47,10 @@ class DscCompilationJobStreamOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def list_by_job( @@ -72,7 +71,7 @@ async def list_by_job( :rtype: ~azure.mgmt.automation.models.JobStreamListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -83,7 +82,7 @@ async def list_by_job( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) _request = build_list_by_job_request( @@ -106,7 +105,10 @@ async def list_by_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("JobStreamListResult", 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 068b7a0b347a..8c90ebde7cac 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code 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, Type, TypeVar, Union, overload +from collections.abc import MutableMapping +from typing import Any, AsyncIterator, Callable, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +28,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._dsc_configuration_operations import ( build_create_or_update_request, build_delete_request, @@ -36,13 +37,11 @@ build_list_by_automation_account_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class DscConfigurationOperations: @@ -59,13 +58,13 @@ class DscConfigurationOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, configuration_name: str, **kwargs: Any ) -> None: """Delete the dsc configuration identified by configuration name. @@ -83,7 +82,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,7 +93,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", "2022-08-08")) + 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( @@ -117,7 +116,10 @@ async def delete( # pylint: disable=inconsistent-return-statements 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -142,7 +144,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.DscConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -153,7 +155,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) _request = build_get_request( @@ -176,7 +178,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscConfiguration", pipeline_response.http_response) @@ -277,7 +282,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.DscConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +293,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", "2022-08-08")) + 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.DscConfiguration] = kwargs.pop("cls", None) @@ -323,7 +328,10 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscConfiguration", pipeline_response.http_response) @@ -424,7 +432,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.DscConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,14 +443,15 @@ async def 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-08-08")) + 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)) + content_type = content_type if parameters else None cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) _json = None _content = None if isinstance(parameters, msrest.Model): - content_type = content_type or "application/json" + content_type = content_type or "application/json" if parameters else None if parameters is not None: _json = self._serialize.body(parameters, "DscConfigurationUpdateParameters") else: @@ -476,7 +485,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscConfiguration", pipeline_response.http_response) @@ -505,7 +517,7 @@ async def get_content( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -516,7 +528,7 @@ async def get_content( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_get_content_request( @@ -563,7 +575,7 @@ def list_by_automation_account( top: Optional[int] = None, inlinecount: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.DscConfiguration"]: + ) -> AsyncItemPaged["_models.DscConfiguration"]: """Retrieve a list of configurations. .. seealso:: @@ -588,10 +600,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.DscConfigurationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -640,7 +652,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 d42ec517e739..2b85144dd04e 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,19 +31,18 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._dsc_node_configuration_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class DscNodeConfigurationOperations: @@ -60,13 +59,13 @@ class DscNodeConfigurationOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, node_configuration_name: str, **kwargs: Any ) -> None: """Delete the Dsc node configurations by node configuration. @@ -84,7 +83,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +94,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -118,7 +117,10 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -143,7 +145,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.DscNodeConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -154,7 +156,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscNodeConfiguration] = kwargs.pop("cls", None) _request = build_get_request( @@ -177,7 +179,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscNodeConfiguration", pipeline_response.http_response) @@ -195,7 +200,7 @@ async def _create_or_update_initial( parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -206,7 +211,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) @@ -246,7 +251,10 @@ async def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -354,7 +362,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) 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) @@ -409,7 +417,7 @@ def list_by_automation_account( top: Optional[int] = None, inlinecount: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.DscNodeConfiguration"]: + ) -> AsyncItemPaged["_models.DscNodeConfiguration"]: """Retrieve a list of dsc node configurations. .. seealso:: @@ -436,10 +444,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscNodeConfigurationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +496,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 f6e455617b6a..03e353300e82 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,19 +27,18 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._dsc_node_operations import ( build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class DscNodeOperations: @@ -56,15 +55,15 @@ class DscNodeOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, node_id: str, **kwargs: Any - ) -> None: + ) -> _models.DscNode: """Delete the dsc node identified by node id. .. seealso:: @@ -76,11 +75,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type automation_account_name: str :param node_id: The node id. Required. :type node_id: str - :return: None or the result of cls(response) - :rtype: None + :return: DscNode or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.DscNode :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,8 +90,8 @@ 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", "2020-01-13-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) + cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -114,11 +113,18 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize("DscNode", pipeline_response.http_response) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def get( @@ -139,7 +145,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.DscNode :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -150,7 +156,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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) _request = build_get_request( @@ -173,7 +179,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscNode", pipeline_response.http_response) @@ -275,7 +284,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.DscNode :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -286,7 +295,7 @@ async def 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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) @@ -321,7 +330,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscNode", pipeline_response.http_response) @@ -341,7 +353,7 @@ def list_by_automation_account( top: Optional[int] = None, inlinecount: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.DscNode"]: + ) -> AsyncItemPaged["_models.DscNode"]: """Retrieve a list of dsc nodes. .. seealso:: @@ -366,10 +378,10 @@ def list_by_automation_account( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscNodeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -418,7 +430,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 67d8594cfb41..fafa79b4ea48 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,14 +25,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._fields_operations import build_list_by_type_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class FieldsOperations: @@ -49,15 +48,15 @@ class FieldsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_type( self, resource_group_name: str, automation_account_name: str, module_name: str, type_name: str, **kwargs: Any - ) -> AsyncIterable["_models.TypeField"]: + ) -> AsyncItemPaged["_models.TypeField"]: """Retrieve a list of fields of a given type identified by module name. .. seealso:: @@ -78,10 +77,10 @@ def list_by_type( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -128,7 +127,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 8bd6cf59cf4b..590f37d0a636 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,20 +27,18 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._hybrid_runbook_worker_group_operations import ( - build_create_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class HybridRunbookWorkerGroupOperations: @@ -57,13 +55,13 @@ class HybridRunbookWorkerGroupOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, @@ -85,7 +83,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,7 +94,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", "2022-08-08")) + 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( @@ -119,7 +117,10 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -148,7 +149,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +160,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) _request = build_get_request( @@ -182,163 +183,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("HybridRunbookWorkerGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_group_creation_parameters: _models.HybridRunbookWorkerGroupCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :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. Required. - :type hybrid_runbook_worker_group_creation_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: HybridRunbookWorkerGroup or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_group_creation_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :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. Required. - :type hybrid_runbook_worker_group_creation_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: HybridRunbookWorkerGroup or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_group_creation_parameters: Union[ - _models.HybridRunbookWorkerGroupCreateOrUpdateParameters, IO[bytes] - ], - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :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 HybridRunbookWorkerGroupCreateOrUpdateParameters type - or a IO[bytes] type. Required. - :type hybrid_runbook_worker_group_creation_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or IO[bytes] - :return: HybridRunbookWorkerGroup or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - 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, (IOBase, bytes)): - _content = hybrid_runbook_worker_group_creation_parameters - else: - _json = self._serialize.body( - hybrid_runbook_worker_group_creation_parameters, "HybridRunbookWorkerGroupCreateOrUpdateParameters" + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, ) - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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("HybridRunbookWorkerGroup", pipeline_response.http_response) @@ -354,7 +202,7 @@ async def update( resource_group_name: str, automation_account_name: str, hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_group_updation_parameters: _models.HybridRunbookWorkerGroupCreateOrUpdateParameters, + parameters: _models.HybridRunbookWorkerGroupUpdateParameters, *, content_type: str = "application/json", **kwargs: Any @@ -370,10 +218,8 @@ async def update( :type automation_account_name: str :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. - Required. - :type hybrid_runbook_worker_group_updation_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters + :param parameters: The hybrid runbook worker group. Required. + :type parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerGroupUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -388,7 +234,7 @@ async def update( resource_group_name: str, automation_account_name: str, hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_group_updation_parameters: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -404,9 +250,8 @@ async def update( :type automation_account_name: str :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. - Required. - :type hybrid_runbook_worker_group_updation_parameters: IO[bytes] + :param parameters: The hybrid runbook worker group. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -421,9 +266,7 @@ async def update( resource_group_name: str, automation_account_name: str, hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_group_updation_parameters: Union[ - _models.HybridRunbookWorkerGroupCreateOrUpdateParameters, IO[bytes] - ], + parameters: Union[_models.HybridRunbookWorkerGroupUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. @@ -437,15 +280,15 @@ async def update( :type automation_account_name: str :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 HybridRunbookWorkerGroupCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type hybrid_runbook_worker_group_updation_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or IO[bytes] + :param parameters: The hybrid runbook worker group. Is either a + HybridRunbookWorkerGroupUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerGroupUpdateParameters or + IO[bytes] :return: HybridRunbookWorkerGroup or the result of cls(response) :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -456,19 +299,17 @@ async def 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-08-08")) + 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.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_group_updation_parameters, (IOBase, bytes)): - _content = hybrid_runbook_worker_group_updation_parameters + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _json = self._serialize.body( - hybrid_runbook_worker_group_updation_parameters, "HybridRunbookWorkerGroupCreateOrUpdateParameters" - ) + _json = self._serialize.body(parameters, "HybridRunbookWorkerGroupUpdateParameters") _request = build_update_request( resource_group_name=resource_group_name, @@ -493,7 +334,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("HybridRunbookWorkerGroup", pipeline_response.http_response) @@ -506,7 +350,7 @@ async def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.HybridRunbookWorkerGroup"]: + ) -> AsyncItemPaged["_models.HybridRunbookWorkerGroup"]: """Retrieve a list of hybrid runbook worker groups. .. seealso:: @@ -527,10 +371,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.HybridRunbookWorkerGroupsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -576,7 +420,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 deleted file mode 100644 index 0d698bd49231..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_workers_operations.py +++ /dev/null @@ -1,609 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, 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.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._hybrid_runbook_workers_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_hybrid_runbook_worker_group_request, - build_move_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class HybridRunbookWorkersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`hybrid_runbook_workers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = 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, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - **kwargs: Any - ) -> 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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. - :type hybrid_runbook_worker_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, - hybrid_runbook_worker_id=hybrid_runbook_worker_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. - :type hybrid_runbook_worker_id: str - :return: HybridRunbookWorker or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, - hybrid_runbook_worker_id=hybrid_runbook_worker_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("HybridRunbookWorker", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - hybrid_runbook_worker_creation_parameters: _models.HybridRunbookWorkerCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :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. Required. - :type hybrid_runbook_worker_creation_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: HybridRunbookWorker or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - hybrid_runbook_worker_creation_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :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. Required. - :type hybrid_runbook_worker_creation_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: HybridRunbookWorker or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - hybrid_runbook_worker_creation_parameters: Union[_models.HybridRunbookWorkerCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :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 HybridRunbookWorkerCreateParameters type or a IO[bytes] type. - Required. - :type hybrid_runbook_worker_creation_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters or IO[bytes] - :return: HybridRunbookWorker or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - 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, (IOBase, bytes)): - _content = hybrid_runbook_worker_creation_parameters - else: - _json = self._serialize.body( - hybrid_runbook_worker_creation_parameters, "HybridRunbookWorkerCreateParameters" - ) - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, - hybrid_runbook_worker_id=hybrid_runbook_worker_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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("HybridRunbookWorker", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def move( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - hybrid_runbook_worker_move_parameters: _models.HybridRunbookWorkerMoveParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> 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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :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. - Required. - :type hybrid_runbook_worker_move_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerMoveParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def move( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - hybrid_runbook_worker_move_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> 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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :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. - Required. - :type hybrid_runbook_worker_move_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def move( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - hybrid_runbook_worker_move_parameters: Union[_models.HybridRunbookWorkerMoveParameters, IO[bytes]], - **kwargs: Any - ) -> 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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :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 HybridRunbookWorkerMoveParameters type or a IO[bytes] type. Required. - :type hybrid_runbook_worker_move_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerMoveParameters or IO[bytes] - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - 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, (IOBase, bytes)): - _content = hybrid_runbook_worker_move_parameters - else: - _json = self._serialize.body(hybrid_runbook_worker_move_parameters, "HybridRunbookWorkerMoveParameters") - - _request = build_move_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, - hybrid_runbook_worker_id=hybrid_runbook_worker_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_by_hybrid_runbook_worker_group( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> 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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :return: An iterator like instance of either HybridRunbookWorker or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.HybridRunbookWorker] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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-08-08")) - cls: ClsType[_models.HybridRunbookWorkersListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_hybrid_runbook_worker_group_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("HybridRunbookWorkersListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/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 11887b633601..e1e5df2ae1bc 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -27,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._job_operations import ( build_create_request, build_get_output_request, @@ -37,13 +40,11 @@ build_stop_request, build_suspend_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class JobOperations: @@ -60,10 +61,10 @@ class JobOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get_output( @@ -73,7 +74,7 @@ async def get_output( job_name: str, client_request_id: Optional[str] = None, **kwargs: Any - ) -> str: + ) -> AsyncIterator[bytes]: """Retrieve the job output identified by job name. .. seealso:: @@ -87,11 +88,11 @@ async def get_output( :type job_name: str :param client_request_id: Identifies this specific client request. Default value is None. :type client_request_id: str - :return: str or the result of cls(response) - :rtype: str + :return: AsyncIterator[bytes] or the result of cls(response) + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -102,8 +103,8 @@ async def get_output( _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-08-08")) - cls: ClsType[str] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_get_output_request( resource_group_name=resource_group_name, @@ -117,7 +118,8 @@ async def get_output( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -125,10 +127,14 @@ async def get_output( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response.http_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -143,7 +149,7 @@ async def get_runbook_content( job_name: str, client_request_id: Optional[str] = None, **kwargs: Any - ) -> str: + ) -> AsyncIterator[bytes]: """Retrieve the runbook content of the job identified by job name. .. seealso:: @@ -157,11 +163,11 @@ async def get_runbook_content( :type job_name: str :param client_request_id: Identifies this specific client request. Default value is None. :type client_request_id: str - :return: str or the result of cls(response) - :rtype: str + :return: AsyncIterator[bytes] or the result of cls(response) + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -172,8 +178,8 @@ async def get_runbook_content( _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-08-08")) - cls: ClsType[str] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_get_runbook_content_request( resource_group_name=resource_group_name, @@ -187,7 +193,8 @@ async def get_runbook_content( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -195,10 +202,18 @@ async def get_runbook_content( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response.http_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -206,7 +221,7 @@ async def get_runbook_content( return deserialized # type: ignore @distributed_trace_async - async def suspend( # pylint: disable=inconsistent-return-statements + async def suspend( self, resource_group_name: str, automation_account_name: str, @@ -231,7 +246,7 @@ async def suspend( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -242,7 +257,7 @@ async def suspend( # 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_suspend_request( @@ -266,14 +281,17 @@ async def suspend( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def stop( # pylint: disable=inconsistent-return-statements + async def stop( self, resource_group_name: str, automation_account_name: str, @@ -298,7 +316,7 @@ async def stop( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -309,7 +327,7 @@ async def stop( # 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_stop_request( @@ -333,7 +351,10 @@ async def stop( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -365,7 +386,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.Job :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -376,7 +397,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) _request = build_get_request( @@ -400,7 +421,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Job", pipeline_response.http_response) @@ -510,7 +534,7 @@ async def create( :rtype: ~azure.mgmt.automation.models.Job :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -521,7 +545,7 @@ async def 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -557,7 +581,10 @@ async def create( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Job", pipeline_response.http_response) @@ -575,7 +602,7 @@ def list_by_automation_account( filter: Optional[str] = None, client_request_id: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.JobCollectionItem"]: + ) -> AsyncItemPaged["_models.JobCollectionItem"]: """Retrieve a list of jobs. .. seealso:: @@ -597,10 +624,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.JobListResultV2] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -647,7 +674,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -655,7 +685,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def resume( # pylint: disable=inconsistent-return-statements + async def resume( self, resource_group_name: str, automation_account_name: str, @@ -680,7 +710,7 @@ async def resume( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -691,7 +721,7 @@ async def resume( # 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_resume_request( @@ -715,7 +745,10 @@ async def resume( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: 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 178b6d10339a..c0485cc3b5ab 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,19 +27,18 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._job_schedule_operations import ( build_create_request, build_delete_request, build_get_request, build_list_by_automation_account_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class JobScheduleOperations: @@ -56,13 +55,13 @@ class JobScheduleOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, job_schedule_id: str, **kwargs: Any ) -> None: """Delete the job schedule identified by job schedule name. @@ -80,7 +79,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + 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( @@ -114,7 +113,10 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -139,7 +141,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.JobSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -150,7 +152,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) _request = build_get_request( @@ -173,7 +175,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("JobSchedule", pipeline_response.http_response) @@ -274,7 +279,7 @@ async def create( :rtype: ~azure.mgmt.automation.models.JobSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -285,7 +290,7 @@ async def 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-08-08")) + 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.JobSchedule] = kwargs.pop("cls", None) @@ -320,7 +325,10 @@ async def create( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("JobSchedule", pipeline_response.http_response) @@ -333,7 +341,7 @@ async def create( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.JobSchedule"]: + ) -> AsyncItemPaged["_models.JobSchedule"]: """Retrieve a list of job schedules. .. seealso:: @@ -352,10 +360,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.JobScheduleListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -401,7 +409,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 3fc94e5dc8e8..b0eb1882812c 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,14 +26,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._job_stream_operations import build_get_request, build_list_by_job_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class JobStreamOperations: @@ -50,10 +49,10 @@ class JobStreamOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -84,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.JobStream :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +94,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) _request = build_get_request( @@ -120,7 +119,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("JobStream", pipeline_response.http_response) @@ -139,7 +141,7 @@ def list_by_job( filter: Optional[str] = None, client_request_id: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.JobStream"]: + ) -> AsyncItemPaged["_models.JobStream"]: """Retrieve a list of jobs streams identified by job name. .. seealso:: @@ -162,10 +164,10 @@ def list_by_job( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +215,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 9a4e13ea71a0..7cc47e032190 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code 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, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,14 +24,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._keys_operations import build_list_by_automation_account_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class KeysOperations: @@ -48,10 +47,10 @@ class KeysOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def list_by_automation_account( @@ -67,7 +66,7 @@ async def list_by_automation_account( :rtype: ~azure.mgmt.automation.models.KeyListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -78,7 +77,7 @@ async def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) _request = build_list_by_automation_account_request( @@ -100,7 +99,10 @@ async def list_by_automation_account( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("KeyListResult", 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 15f368f225f0..b01936a54f92 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code 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, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,14 +24,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._linked_workspace_operations import build_get_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class LinkedWorkspaceOperations: @@ -48,10 +47,10 @@ class LinkedWorkspaceOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -70,7 +69,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.LinkedWorkspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -81,7 +80,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.LinkedWorkspace] = kwargs.pop("cls", None) _request = build_get_request( @@ -103,7 +102,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("LinkedWorkspace", 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 5af04c53f7a4..f2032d114a88 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._module_operations import ( build_create_or_update_request, build_delete_request, @@ -34,13 +35,11 @@ build_list_by_automation_account_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ModuleOperations: @@ -57,13 +56,13 @@ class ModuleOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any ) -> None: """Delete the module by name. @@ -81,7 +80,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + 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( @@ -115,7 +114,10 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -140,7 +142,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.Module :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -151,7 +153,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Module] = kwargs.pop("cls", None) _request = build_get_request( @@ -174,7 +176,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Module", pipeline_response.http_response) @@ -275,7 +280,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.Module :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -286,7 +291,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", "2022-08-08")) + 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.Module] = kwargs.pop("cls", None) @@ -321,7 +326,10 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Module", pipeline_response.http_response) @@ -422,7 +430,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.Module :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,7 +441,7 @@ async def 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-08-08")) + 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.Module] = kwargs.pop("cls", None) @@ -468,7 +476,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Module", pipeline_response.http_response) @@ -481,7 +492,7 @@ async def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Module"]: + ) -> AsyncItemPaged["_models.Module"]: """Retrieve a list of modules. .. seealso:: @@ -498,10 +509,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -546,7 +557,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 a1b57eba0371..926980ef42f6 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code 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, Type, TypeVar, Union +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar, Union +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,14 +24,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._node_count_information_operations import build_get_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class NodeCountInformationOperations: @@ -48,10 +47,10 @@ class NodeCountInformationOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -77,7 +76,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.NodeCounts :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -88,7 +87,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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.NodeCounts] = kwargs.pop("cls", None) _request = build_get_request( @@ -111,7 +110,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("NodeCounts", 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 462804d95350..f1421b5544a3 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,19 +26,18 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._node_reports_operations import ( build_get_content_request, build_get_request, build_list_by_node_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class NodeReportsOperations: @@ -55,10 +54,10 @@ class NodeReportsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_node( @@ -68,7 +67,7 @@ def list_by_node( node_id: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.DscNodeReport"]: + ) -> AsyncItemPaged["_models.DscNodeReport"]: """Retrieve the Dsc node report list by node id. .. seealso:: @@ -89,10 +88,10 @@ def list_by_node( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscNodeReportListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +138,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -167,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.DscNodeReport :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -178,7 +180,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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscNodeReport] = kwargs.pop("cls", None) _request = build_get_request( @@ -202,7 +204,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscNodeReport", pipeline_response.http_response) @@ -233,7 +238,7 @@ async def get_content( :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +249,7 @@ async def get_content( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[JSON] = kwargs.pop("cls", None) _request = build_get_content_request( @@ -268,7 +273,10 @@ async def get_content( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("object", 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 a31237870262..d75e8cd01635 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,17 +25,16 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._object_data_types_operations import ( build_list_fields_by_module_and_type_request, build_list_fields_by_type_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ObjectDataTypesOperations: @@ -52,15 +51,15 @@ class ObjectDataTypesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_fields_by_module_and_type( self, resource_group_name: str, automation_account_name: str, module_name: str, type_name: str, **kwargs: Any - ) -> AsyncIterable["_models.TypeField"]: + ) -> AsyncItemPaged["_models.TypeField"]: """Retrieve a list of fields of a given type identified by module name. .. seealso:: @@ -81,10 +80,10 @@ def list_fields_by_module_and_type( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +130,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -141,7 +143,7 @@ async def get_next(next_link=None): @distributed_trace def list_fields_by_type( self, resource_group_name: str, automation_account_name: str, type_name: str, **kwargs: Any - ) -> AsyncIterable["_models.TypeField"]: + ) -> AsyncItemPaged["_models.TypeField"]: """Retrieve a list of fields of a given type across all accessible modules. .. seealso:: @@ -160,10 +162,10 @@ def list_fields_by_type( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +211,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 30b01b203a50..f9d0aaea0abd 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,14 +25,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._operations import build_list_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class Operations: @@ -49,13 +48,13 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: """Lists all of the available Automation REST API operations. :return: An iterator like instance of either Operation or the result of cls(response) @@ -65,10 +64,10 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +109,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_patch.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_patch.py index f7dd32510333..49900f6ab120 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_patch.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_patch.py @@ -2,6 +2,7 @@ # 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 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 deleted file mode 100644 index c01c5856fbd0..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,523 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._private_endpoint_connections_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_automation_account_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'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") - - @distributed_trace - def list_by_automation_account( - self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnection"]: - """List all private endpoint connections on a Automation account. - - :param resource_group_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 - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.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", "2020-01-13-preview")) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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 None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets a private endpoint connection. - - :param resource_group_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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PrivateEndpointConnection") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - parameters: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: ~azure.mgmt.automation.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.PrivateEndpointConnection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_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-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) - lro_delay = kwargs.pop("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, - automation_account_name=automation_account_name, - private_endpoint_connection_name=private_endpoint_connection_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a private endpoint connection with a given name. - - :param resource_group_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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - private_endpoint_connection_name=private_endpoint_connection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/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 deleted file mode 100644 index 00e3722848c2..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,127 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._private_link_resources_operations import build_automation_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'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") - - @distributed_trace - def automation( - self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateLinkResource"]: - """Gets the private link resources that need to be created for Automation account. - - :param resource_group_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 - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.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", "2020-01-13-preview")) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_automation_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) 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 05a40ba7e870..0e04953a4e07 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._python2_package_operations import ( build_create_or_update_request, build_delete_request, @@ -34,13 +35,11 @@ build_list_by_automation_account_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class Python2PackageOperations: @@ -57,13 +56,13 @@ class Python2PackageOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, package_name: str, **kwargs: Any ) -> None: """Delete the python 2 package by name. @@ -81,7 +80,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -115,7 +114,10 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -140,7 +142,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.Module :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -151,7 +153,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.Module] = kwargs.pop("cls", None) _request = build_get_request( @@ -174,7 +176,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Module", pipeline_response.http_response) @@ -275,7 +280,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.Module :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -286,7 +291,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) @@ -321,7 +326,10 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Module", pipeline_response.http_response) @@ -422,7 +430,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.Module :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,7 +441,7 @@ async def 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) @@ -468,7 +476,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Module", pipeline_response.http_response) @@ -481,7 +492,7 @@ async def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Module"]: + ) -> AsyncItemPaged["_models.Module"]: """Retrieve a list of python 2 packages. .. seealso:: @@ -498,10 +509,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -546,7 +557,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 deleted file mode 100644 index 7bea655a19e9..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python3_package_operations.py +++ /dev/null @@ -1,554 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, 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.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._python3_package_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_automation_account_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Python3PackageOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`python3_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 delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, package_name: str, **kwargs: Any - ) -> 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. - :type automation_account_name: str - :param package_name: The python package name. Required. - :type package_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - package_name=package_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, package_name: str, **kwargs: Any - ) -> _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. - :type automation_account_name: str - :param package_name: The python package name. Required. - :type package_name: str - :return: Module or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Module - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - cls: ClsType[_models.Module] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - package_name=package_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Module", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - package_name: str, - parameters: _models.PythonPackageCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. Required. - :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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, - package_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: 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, - package_name: str, - parameters: Union[_models.PythonPackageCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _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 - PythonPackageCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or IO[bytes] - :return: Module or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Module - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - 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, "PythonPackageCreateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - package_name=package_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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("Module", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - package_name: str, - parameters: _models.PythonPackageUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. Required. - :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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, - package_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: 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, - package_name: str, - parameters: Union[_models.PythonPackageUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _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 - PythonPackageUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or IO[bytes] - :return: Module or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Module - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - 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, "PythonPackageUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - package_name=package_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Module", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @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 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. - :type automation_account_name: str - :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", "2022-08-08")) - cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) 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 4335aa6616df..b9ca9bce2b03 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code 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, Type, TypeVar, Union, cast +from collections.abc import MutableMapping +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -28,19 +28,18 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._runbook_draft_operations import ( build_get_content_request, build_get_request, build_replace_content_request, build_undo_edit_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class RunbookDraftOperations: @@ -57,10 +56,10 @@ class RunbookDraftOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get_content( @@ -81,7 +80,7 @@ async def get_content( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,7 +91,7 @@ async def get_content( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_get_content_request( @@ -137,7 +136,7 @@ async def _replace_content_initial( runbook_content: IO[bytes], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -148,7 +147,7 @@ async def _replace_content_initial( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) @@ -181,7 +180,10 @@ async def _replace_content_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -215,7 +217,7 @@ async def begin_replace_content( :type automation_account_name: str :param runbook_name: The runbook name. Required. :type runbook_name: str - :param runbook_content: The runbook draft content. Required. + :param runbook_content: The runbook draft content. Required. :type runbook_content: IO[bytes] :return: An instance of AsyncLROPoller that returns either AsyncIterator[bytes] or the result of cls(response) @@ -225,7 +227,7 @@ async def begin_replace_content( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) 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) @@ -254,10 +256,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -292,7 +291,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.RunbookDraft :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -303,7 +302,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.RunbookDraft] = kwargs.pop("cls", None) _request = build_get_request( @@ -326,7 +325,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("RunbookDraft", pipeline_response.http_response) @@ -355,7 +357,7 @@ async def undo_edit( :rtype: ~azure.mgmt.automation.models.RunbookDraftUndoEditResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -366,7 +368,7 @@ async def undo_edit( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.RunbookDraftUndoEditResult] = kwargs.pop("cls", None) _request = build_undo_edit_request( @@ -389,7 +391,10 @@ async def undo_edit( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("RunbookDraftUndoEditResult", 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 428ce24a70af..3bfb8d004f41 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +31,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._runbook_operations import ( build_create_or_update_request, build_delete_request, @@ -40,13 +41,11 @@ build_publish_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class RunbookOperations: @@ -63,15 +62,15 @@ class RunbookOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def _publish_initial( self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -82,7 +81,7 @@ async def _publish_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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_publish_request( @@ -110,7 +109,10 @@ async def _publish_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -145,7 +147,7 @@ async def begin_publish( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -202,7 +204,7 @@ async def get_content( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +215,7 @@ async def get_content( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_get_content_request( @@ -269,7 +271,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.Runbook :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -280,7 +282,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) _request = build_get_request( @@ -303,7 +305,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Runbook", pipeline_response.http_response) @@ -407,7 +412,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.Runbook :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -418,7 +423,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) @@ -453,7 +458,10 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Runbook", pipeline_response.http_response) @@ -554,7 +562,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.Runbook :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -565,7 +573,7 @@ async def 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) @@ -600,7 +608,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Runbook", pipeline_response.http_response) @@ -611,7 +622,7 @@ async def update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any ) -> None: """Delete the runbook by name. @@ -629,7 +640,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -640,7 +651,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -663,7 +674,10 @@ async def delete( # pylint: disable=inconsistent-return-statements 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -672,7 +686,7 @@ async def delete( # pylint: disable=inconsistent-return-statements @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Runbook"]: + ) -> AsyncItemPaged["_models.Runbook"]: """Retrieve a list of runbooks. .. seealso:: @@ -689,10 +703,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.RunbookListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -737,7 +751,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 4eb112524313..844bb805ec41 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._schedule_operations import ( build_create_or_update_request, build_delete_request, @@ -34,13 +35,11 @@ build_list_by_automation_account_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ScheduleOperations: @@ -57,10 +56,10 @@ class ScheduleOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def create_or_update( @@ -155,7 +154,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.Schedule or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +165,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", "2022-08-08")) + 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[Optional[_models.Schedule]] = kwargs.pop("cls", None) @@ -201,7 +200,10 @@ async def create_or_update( if response.status_code not in [200, 201, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -303,7 +305,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,7 +316,7 @@ async def 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-08-08")) + 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.Schedule] = kwargs.pop("cls", None) @@ -349,7 +351,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Schedule", pipeline_response.http_response) @@ -378,7 +383,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -389,7 +394,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) _request = build_get_request( @@ -412,7 +417,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Schedule", pipeline_response.http_response) @@ -423,7 +431,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, schedule_name: str, **kwargs: Any ) -> None: """Delete the schedule identified by schedule name. @@ -441,7 +449,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -452,7 +460,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", "2022-08-08")) + 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( @@ -475,7 +483,10 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -484,7 +495,7 @@ async def delete( # pylint: disable=inconsistent-return-statements @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Schedule"]: + ) -> AsyncItemPaged["_models.Schedule"]: """Retrieve a list of schedules. .. seealso:: @@ -501,10 +512,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.ScheduleListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -549,7 +560,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 cbda0360da8e..2241cb560a5a 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code 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, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,17 +24,16 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._software_update_configuration_machine_runs_operations import ( build_get_by_id_request, build_list_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class SoftwareUpdateConfigurationMachineRunsOperations: # pylint: disable=name-too-long @@ -51,10 +50,10 @@ class SoftwareUpdateConfigurationMachineRunsOperations: # pylint: disable=name- def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get_by_id( @@ -83,7 +82,7 @@ async def get_by_id( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,7 +93,7 @@ async def get_by_id( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SoftwareUpdateConfigurationMachineRun] = kwargs.pop("cls", None) _request = build_get_by_id_request( @@ -118,7 +117,10 @@ async def get_by_id( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SoftwareUpdateConfigurationMachineRun", pipeline_response.http_response) @@ -163,7 +165,7 @@ async def list( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRunListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -174,7 +176,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SoftwareUpdateConfigurationMachineRunListResult] = kwargs.pop("cls", None) _request = build_list_request( @@ -200,7 +202,10 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize( 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 4bb51db6836c..092851ef842a 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code 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, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,14 +24,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._software_update_configuration_runs_operations import build_get_by_id_request, build_list_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class SoftwareUpdateConfigurationRunsOperations: # pylint: disable=name-too-long @@ -48,10 +47,10 @@ class SoftwareUpdateConfigurationRunsOperations: # pylint: disable=name-too-lon def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get_by_id( @@ -80,7 +79,7 @@ async def get_by_id( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +90,7 @@ async def get_by_id( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SoftwareUpdateConfigurationRun] = kwargs.pop("cls", None) _request = build_get_by_id_request( @@ -115,7 +114,10 @@ async def get_by_id( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SoftwareUpdateConfigurationRun", pipeline_response.http_response) @@ -160,7 +162,7 @@ async def list( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +173,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SoftwareUpdateConfigurationRunListResult] = kwargs.pop("cls", None) _request = build_list_request( @@ -197,7 +199,10 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SoftwareUpdateConfigurationRunListResult", 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 bcc0ca752f4f..e6c75fcd5cf0 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,19 +25,18 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._software_update_configurations_operations import ( build_create_request, build_delete_request, build_get_by_name_request, build_list_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class SoftwareUpdateConfigurationsOperations: @@ -54,10 +53,10 @@ class SoftwareUpdateConfigurationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def create( @@ -162,7 +161,7 @@ async def create( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -173,7 +172,7 @@ async def 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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) @@ -209,7 +208,10 @@ async def create( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SoftwareUpdateConfiguration", pipeline_response.http_response) @@ -246,7 +248,7 @@ async def get_by_name( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,7 +259,7 @@ async def get_by_name( _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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) _request = build_get_by_name_request( @@ -281,7 +283,10 @@ async def get_by_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SoftwareUpdateConfiguration", pipeline_response.http_response) @@ -292,7 +297,7 @@ async def get_by_name( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, @@ -318,7 +323,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +334,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", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -353,7 +358,10 @@ async def delete( # pylint: disable=inconsistent-return-statements 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -385,7 +393,7 @@ async def list( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -396,7 +404,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", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SoftwareUpdateConfigurationListResult] = kwargs.pop("cls", None) _request = build_list_request( @@ -420,7 +428,10 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SoftwareUpdateConfigurationListResult", 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 ab96aeedcc28..d3591dcc6e64 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._source_control_operations import ( build_create_or_update_request, build_delete_request, @@ -34,13 +35,11 @@ build_list_by_automation_account_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class SourceControlOperations: @@ -57,10 +56,10 @@ class SourceControlOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def create_or_update( @@ -156,7 +155,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +166,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) @@ -202,7 +201,10 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SourceControl", pipeline_response.http_response) @@ -303,7 +305,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,7 +316,7 @@ async def 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) @@ -349,7 +351,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SourceControl", pipeline_response.http_response) @@ -360,7 +365,7 @@ async def update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, source_control_name: str, **kwargs: Any ) -> None: """Delete the source control. @@ -378,7 +383,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -389,7 +394,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -412,7 +417,10 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -437,7 +445,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,7 +456,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) _request = build_get_request( @@ -471,7 +479,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SourceControl", pipeline_response.http_response) @@ -484,7 +495,7 @@ async def get( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.SourceControl"]: + ) -> AsyncItemPaged["_models.SourceControl"]: """Retrieve a list of source controls. .. seealso:: @@ -503,10 +514,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SourceControlListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -552,7 +563,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 55db95ab3fe9..8bf92b030103 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,18 +27,17 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._source_control_sync_job_operations import ( build_create_request, build_get_request, build_list_by_automation_account_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class SourceControlSyncJobOperations: @@ -55,10 +54,10 @@ class SourceControlSyncJobOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def create( @@ -163,7 +162,7 @@ async def create( :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -174,7 +173,7 @@ async def 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControlSyncJob] = kwargs.pop("cls", None) @@ -210,7 +209,10 @@ async def create( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SourceControlSyncJob", pipeline_response.http_response) @@ -246,7 +248,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobById :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,7 +259,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SourceControlSyncJobById] = kwargs.pop("cls", None) _request = build_get_request( @@ -281,7 +283,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SourceControlSyncJobById", pipeline_response.http_response) @@ -299,7 +304,7 @@ def list_by_automation_account( source_control_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.SourceControlSyncJob"]: + ) -> AsyncItemPaged["_models.SourceControlSyncJob"]: """Retrieve a list of source control sync jobs. .. seealso:: @@ -322,10 +327,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SourceControlSyncJobListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +377,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 f32413ae0e0e..e3017a5e88a6 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,14 +26,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._source_control_sync_job_streams_operations import build_get_request, build_list_by_sync_job_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class SourceControlSyncJobStreamsOperations: @@ -50,10 +49,10 @@ class SourceControlSyncJobStreamsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_sync_job( @@ -64,7 +63,7 @@ def list_by_sync_job( source_control_sync_job_id: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.SourceControlSyncJobStream"]: + ) -> AsyncItemPaged["_models.SourceControlSyncJobStream"]: """Retrieve a list of sync job streams identified by sync job id. .. seealso:: @@ -89,10 +88,10 @@ def list_by_sync_job( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SourceControlSyncJobStreamsListBySyncJob] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -140,7 +139,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -176,7 +178,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobStreamById :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,7 +189,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SourceControlSyncJobStreamById] = kwargs.pop("cls", None) _request = build_get_request( @@ -212,7 +214,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SourceControlSyncJobStreamById", 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 e83b2440adab..12b30cab3e1c 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,14 +25,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._statistics_operations import build_list_by_automation_account_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class StatisticsOperations: @@ -49,15 +48,15 @@ class StatisticsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Statistics"]: + ) -> AsyncItemPaged["_models.Statistics"]: """Retrieve the statistics for the account. .. seealso:: @@ -76,10 +75,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.StatisticsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -125,7 +124,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 0d4f4d1b1307..79a5414400e9 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,6 +25,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._test_job_operations import ( build_create_request, build_get_request, @@ -32,13 +33,11 @@ build_stop_request, build_suspend_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class TestJobOperations: @@ -55,10 +54,10 @@ class TestJobOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def create( @@ -151,7 +150,7 @@ async def create( :rtype: ~azure.mgmt.automation.models.TestJob :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +161,7 @@ async def 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) @@ -197,7 +196,10 @@ async def create( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("TestJob", pipeline_response.http_response) @@ -226,7 +228,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.TestJob :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -237,7 +239,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) _request = build_get_request( @@ -260,7 +262,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("TestJob", pipeline_response.http_response) @@ -271,7 +276,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def resume( # pylint: disable=inconsistent-return-statements + async def resume( self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any ) -> None: """Resume the test job. @@ -289,7 +294,7 @@ async def resume( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,7 +305,7 @@ async def resume( # 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_resume_request( @@ -323,14 +328,17 @@ async def resume( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def stop( # pylint: disable=inconsistent-return-statements + async def stop( self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any ) -> None: """Stop the test job. @@ -348,7 +356,7 @@ async def stop( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +367,7 @@ async def stop( # 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_stop_request( @@ -382,14 +390,17 @@ async def stop( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def suspend( # pylint: disable=inconsistent-return-statements + async def suspend( self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any ) -> None: """Suspend the test job. @@ -407,7 +418,7 @@ async def suspend( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -418,7 +429,7 @@ async def suspend( # 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_suspend_request( @@ -441,7 +452,10 @@ async def suspend( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: 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 4f53f697e7c7..900d0a2de473 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,14 +26,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._test_job_streams_operations import build_get_request, build_list_by_test_job_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class TestJobStreamsOperations: @@ -50,10 +49,10 @@ class TestJobStreamsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -81,7 +80,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.JobStream :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,7 +91,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) _request = build_get_request( @@ -116,7 +115,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("JobStream", pipeline_response.http_response) @@ -134,7 +136,7 @@ def list_by_test_job( runbook_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.JobStream"]: + ) -> AsyncItemPaged["_models.JobStream"]: """Retrieve a list of test job streams identified by runbook name. .. seealso:: @@ -155,10 +157,10 @@ def list_by_test_job( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +207,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 23ec59e137ad..60fce1c79274 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,14 +25,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._usages_operations import build_list_by_automation_account_request +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class UsagesOperations: @@ -49,15 +48,15 @@ class UsagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Usage"]: + ) -> AsyncItemPaged["_models.Usage"]: """Retrieve the usage for the account id. .. seealso:: @@ -74,10 +73,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -122,7 +121,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 8b5963884993..62b991820de2 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._variable_operations import ( build_create_or_update_request, build_delete_request, @@ -34,13 +35,11 @@ build_list_by_automation_account_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class VariableOperations: @@ -57,10 +56,10 @@ class VariableOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def create_or_update( @@ -155,7 +154,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.Variable :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +165,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", "2022-08-08")) + 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.Variable] = kwargs.pop("cls", None) @@ -201,7 +200,10 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Variable", pipeline_response.http_response) @@ -302,7 +304,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.Variable :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,7 +315,7 @@ async def 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-08-08")) + 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.Variable] = kwargs.pop("cls", None) @@ -348,7 +350,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Variable", pipeline_response.http_response) @@ -359,7 +364,7 @@ async def update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, variable_name: str, **kwargs: Any ) -> None: """Delete the variable. @@ -377,7 +382,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -388,7 +393,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", "2022-08-08")) + 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( @@ -411,7 +416,10 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -436,7 +444,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.Variable :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,7 +455,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) _request = build_get_request( @@ -470,7 +478,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Variable", pipeline_response.http_response) @@ -483,7 +494,7 @@ async def get( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Variable"]: + ) -> AsyncItemPaged["_models.Variable"]: """Retrieve a list of variables. .. seealso:: @@ -500,10 +511,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.VariableListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -548,7 +559,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 c49a4b969e2f..e92b70568741 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._watcher_operations import ( build_create_or_update_request, build_delete_request, @@ -36,13 +37,11 @@ build_stop_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class WatcherOperations: @@ -59,10 +58,10 @@ class WatcherOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def create_or_update( @@ -155,7 +154,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.Watcher :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +165,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", "2020-01-13-preview")) + 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.Watcher] = kwargs.pop("cls", None) @@ -201,7 +200,10 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Watcher", pipeline_response.http_response) @@ -230,7 +232,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.Watcher :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -241,7 +243,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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) _request = build_get_request( @@ -264,7 +266,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Watcher", pipeline_response.http_response) @@ -365,7 +370,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.Watcher :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -376,7 +381,7 @@ async def 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-01-13-preview")) + 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.Watcher] = kwargs.pop("cls", None) @@ -411,7 +416,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Watcher", pipeline_response.http_response) @@ -422,7 +430,7 @@ async def update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any ) -> None: """Delete the watcher by name. @@ -440,7 +448,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -451,7 +459,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", "2020-01-13-preview")) + 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( @@ -474,14 +482,17 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def start( # pylint: disable=inconsistent-return-statements + async def start( self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any ) -> None: """Resume the watcher identified by watcher name. @@ -499,7 +510,7 @@ async def start( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +521,7 @@ async def start( # 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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_start_request( @@ -533,14 +544,17 @@ async def start( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def stop( # pylint: disable=inconsistent-return-statements + async def stop( self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any ) -> None: """Resume the watcher identified by watcher name. @@ -558,7 +572,7 @@ async def stop( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -569,7 +583,7 @@ async def stop( # 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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_stop_request( @@ -592,7 +606,10 @@ async def stop( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -601,7 +618,7 @@ async def stop( # pylint: disable=inconsistent-return-statements @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Watcher"]: + ) -> AsyncItemPaged["_models.Watcher"]: """Retrieve a list of watchers. .. seealso:: @@ -620,10 +637,10 @@ def list_by_automation_account( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.WatcherListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -669,7 +686,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 376103325151..2f1b464b192e 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._webhook_operations import ( build_create_or_update_request, build_delete_request, @@ -35,13 +36,11 @@ build_list_by_automation_account_request, build_update_request, ) +from .._configuration import AutomationClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class WebhookOperations: @@ -58,10 +57,10 @@ class WebhookOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def generate_uri(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> str: @@ -78,7 +77,7 @@ async def generate_uri(self, resource_group_name: str, automation_account_name: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,7 +110,10 @@ async def generate_uri(self, resource_group_name: str, automation_account_name: if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("str", pipeline_response.http_response) @@ -122,7 +124,7 @@ async def generate_uri(self, resource_group_name: str, automation_account_name: return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, automation_account_name: str, webhook_name: str, **kwargs: Any ) -> None: """Delete the webhook by name. @@ -140,7 +142,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -174,7 +176,10 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -199,7 +204,7 @@ async def get( :rtype: ~azure.mgmt.automation.models.Webhook :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -233,7 +238,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Webhook", pipeline_response.http_response) @@ -334,7 +342,7 @@ async def create_or_update( :rtype: ~azure.mgmt.automation.models.Webhook :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -380,7 +388,10 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Webhook", pipeline_response.http_response) @@ -481,7 +492,7 @@ async def update( :rtype: ~azure.mgmt.automation.models.Webhook :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -527,7 +538,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Webhook", pipeline_response.http_response) @@ -540,7 +554,7 @@ async def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Webhook"]: + ) -> AsyncItemPaged["_models.Webhook"]: """Retrieve a list of webhooks. .. seealso:: @@ -562,7 +576,7 @@ def list_by_automation_account( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.WebhookListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -608,7 +622,10 @@ async def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py index c8280851cdf8..d8e72d9bc44e 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py @@ -5,226 +5,210 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import Activity -from ._models_py3 import ActivityListResult -from ._models_py3 import ActivityOutputType -from ._models_py3 import ActivityParameter -from ._models_py3 import ActivityParameterSet -from ._models_py3 import ActivityParameterValidationSet -from ._models_py3 import AdvancedSchedule -from ._models_py3 import AdvancedScheduleMonthlyOccurrence -from ._models_py3 import AgentRegistration -from ._models_py3 import AgentRegistrationKeys -from ._models_py3 import AgentRegistrationRegenerateKeyParameter -from ._models_py3 import AutomationAccount -from ._models_py3 import AutomationAccountCreateOrUpdateParameters -from ._models_py3 import AutomationAccountListResult -from ._models_py3 import AutomationAccountUpdateParameters -from ._models_py3 import AzureQueryProperties -from ._models_py3 import Certificate -from ._models_py3 import CertificateCreateOrUpdateParameters -from ._models_py3 import CertificateListResult -from ._models_py3 import CertificateUpdateParameters -from ._models_py3 import Connection -from ._models_py3 import ConnectionCreateOrUpdateParameters -from ._models_py3 import ConnectionListResult -from ._models_py3 import ConnectionType -from ._models_py3 import ConnectionTypeAssociationProperty -from ._models_py3 import ConnectionTypeCreateOrUpdateParameters -from ._models_py3 import ConnectionTypeListResult -from ._models_py3 import ConnectionUpdateParameters -from ._models_py3 import ContentHash -from ._models_py3 import ContentLink -from ._models_py3 import ContentSource -from ._models_py3 import Credential -from ._models_py3 import CredentialCreateOrUpdateParameters -from ._models_py3 import CredentialListResult -from ._models_py3 import CredentialUpdateParameters -from ._models_py3 import DeletedAutomationAccount -from ._models_py3 import DeletedAutomationAccountListResult -from ._models_py3 import Dimension -from ._models_py3 import DscCompilationJob -from ._models_py3 import DscCompilationJobCreateParameters -from ._models_py3 import DscCompilationJobListResult -from ._models_py3 import DscConfiguration -from ._models_py3 import DscConfigurationAssociationProperty -from ._models_py3 import DscConfigurationCreateOrUpdateParameters -from ._models_py3 import DscConfigurationListResult -from ._models_py3 import DscConfigurationParameter -from ._models_py3 import DscConfigurationUpdateParameters -from ._models_py3 import DscMetaConfiguration -from ._models_py3 import DscNode -from ._models_py3 import DscNodeConfiguration -from ._models_py3 import DscNodeConfigurationCreateOrUpdateParameters -from ._models_py3 import DscNodeConfigurationListResult -from ._models_py3 import DscNodeExtensionHandlerAssociationProperty -from ._models_py3 import DscNodeListResult -from ._models_py3 import DscNodeReport -from ._models_py3 import DscNodeReportListResult -from ._models_py3 import DscNodeUpdateParameters -from ._models_py3 import DscNodeUpdateParametersProperties -from ._models_py3 import DscReportError -from ._models_py3 import DscReportResource -from ._models_py3 import DscReportResourceNavigation -from ._models_py3 import EncryptionProperties -from ._models_py3 import EncryptionPropertiesIdentity -from ._models_py3 import ErrorResponse -from ._models_py3 import FieldDefinition -from ._models_py3 import GraphicalRunbookContent -from ._models_py3 import HybridRunbookWorker -from ._models_py3 import HybridRunbookWorkerCreateParameters -from ._models_py3 import HybridRunbookWorkerGroup -from ._models_py3 import HybridRunbookWorkerGroupCreateOrUpdateParameters -from ._models_py3 import HybridRunbookWorkerGroupsListResult -from ._models_py3 import HybridRunbookWorkerMoveParameters -from ._models_py3 import HybridRunbookWorkersListResult -from ._models_py3 import Identity -from ._models_py3 import Job -from ._models_py3 import JobCollectionItem -from ._models_py3 import JobCreateParameters -from ._models_py3 import JobListResultV2 -from ._models_py3 import JobNavigation -from ._models_py3 import JobSchedule -from ._models_py3 import JobScheduleCreateParameters -from ._models_py3 import JobScheduleListResult -from ._models_py3 import JobStream -from ._models_py3 import JobStreamListResult -from ._models_py3 import Key -from ._models_py3 import KeyListResult -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LinkedWorkspace -from ._models_py3 import LinuxProperties -from ._models_py3 import LogSpecification -from ._models_py3 import MetricSpecification -from ._models_py3 import Module -from ._models_py3 import ModuleCreateOrUpdateParameters -from ._models_py3 import ModuleErrorInfo -from ._models_py3 import ModuleListResult -from ._models_py3 import ModuleUpdateParameters -from ._models_py3 import NodeCount -from ._models_py3 import NodeCountProperties -from ._models_py3 import NodeCounts -from ._models_py3 import NonAzureQueryProperties -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import OperationPropertiesFormatServiceSpecification -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateEndpointProperty -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionStateProperty -from ._models_py3 import ProxyResource -from ._models_py3 import PythonPackageCreateParameters -from ._models_py3 import PythonPackageUpdateParameters -from ._models_py3 import RawGraphicalRunbookContent -from ._models_py3 import Resource -from ._models_py3 import RunAsCredentialAssociationProperty -from ._models_py3 import Runbook -from ._models_py3 import RunbookAssociationProperty -from ._models_py3 import RunbookCreateOrUpdateDraftParameters -from ._models_py3 import RunbookCreateOrUpdateDraftProperties -from ._models_py3 import RunbookCreateOrUpdateParameters -from ._models_py3 import RunbookDraft -from ._models_py3 import RunbookDraftUndoEditResult -from ._models_py3 import RunbookListResult -from ._models_py3 import RunbookParameter -from ._models_py3 import RunbookUpdateParameters -from ._models_py3 import SUCScheduleProperties -from ._models_py3 import Schedule -from ._models_py3 import ScheduleAssociationProperty -from ._models_py3 import ScheduleCreateOrUpdateParameters -from ._models_py3 import ScheduleListResult -from ._models_py3 import ScheduleUpdateParameters -from ._models_py3 import Sku -from ._models_py3 import SoftwareUpdateConfiguration -from ._models_py3 import SoftwareUpdateConfigurationCollectionItem -from ._models_py3 import SoftwareUpdateConfigurationListResult -from ._models_py3 import SoftwareUpdateConfigurationMachineRun -from ._models_py3 import SoftwareUpdateConfigurationMachineRunListResult -from ._models_py3 import SoftwareUpdateConfigurationRun -from ._models_py3 import SoftwareUpdateConfigurationRunListResult -from ._models_py3 import SoftwareUpdateConfigurationRunTaskProperties -from ._models_py3 import SoftwareUpdateConfigurationRunTasks -from ._models_py3 import SoftwareUpdateConfigurationTasks -from ._models_py3 import SourceControl -from ._models_py3 import SourceControlCreateOrUpdateParameters -from ._models_py3 import SourceControlListResult -from ._models_py3 import SourceControlSecurityTokenProperties -from ._models_py3 import SourceControlSyncJob -from ._models_py3 import SourceControlSyncJobById -from ._models_py3 import SourceControlSyncJobCreateParameters -from ._models_py3 import SourceControlSyncJobListResult -from ._models_py3 import SourceControlSyncJobStream -from ._models_py3 import SourceControlSyncJobStreamById -from ._models_py3 import SourceControlSyncJobStreamsListBySyncJob -from ._models_py3 import SourceControlUpdateParameters -from ._models_py3 import Statistics -from ._models_py3 import StatisticsListResult -from ._models_py3 import SystemData -from ._models_py3 import TagSettingsProperties -from ._models_py3 import TargetProperties -from ._models_py3 import TaskProperties -from ._models_py3 import TestJob -from ._models_py3 import TestJobCreateParameters -from ._models_py3 import TrackedResource -from ._models_py3 import TypeField -from ._models_py3 import TypeFieldListResult -from ._models_py3 import UpdateConfiguration -from ._models_py3 import UpdateConfigurationNavigation -from ._models_py3 import Usage -from ._models_py3 import UsageCounterName -from ._models_py3 import UsageListResult -from ._models_py3 import UserAssignedIdentitiesProperties -from ._models_py3 import Variable -from ._models_py3 import VariableCreateOrUpdateParameters -from ._models_py3 import VariableListResult -from ._models_py3 import VariableUpdateParameters -from ._models_py3 import Watcher -from ._models_py3 import WatcherListResult -from ._models_py3 import WatcherUpdateParameters -from ._models_py3 import Webhook -from ._models_py3 import WebhookCreateOrUpdateParameters -from ._models_py3 import WebhookListResult -from ._models_py3 import WebhookUpdateParameters -from ._models_py3 import WindowsProperties +from typing import TYPE_CHECKING -from ._automation_client_enums import AgentRegistrationKeyName -from ._automation_client_enums import AutomationAccountState -from ._automation_client_enums import AutomationKeyName -from ._automation_client_enums import AutomationKeyPermissions -from ._automation_client_enums import ContentSourceType -from ._automation_client_enums import CountType -from ._automation_client_enums import CreatedByType -from ._automation_client_enums import DscConfigurationState -from ._automation_client_enums import EncryptionKeySourceType -from ._automation_client_enums import GraphRunbookType -from ._automation_client_enums import GroupTypeEnum -from ._automation_client_enums import HttpStatusCode -from ._automation_client_enums import JobProvisioningState -from ._automation_client_enums import JobStatus -from ._automation_client_enums import JobStreamType -from ._automation_client_enums import LinuxUpdateClasses -from ._automation_client_enums import ModuleProvisioningState -from ._automation_client_enums import OperatingSystemType -from ._automation_client_enums import ProvisioningState -from ._automation_client_enums import ResourceIdentityType -from ._automation_client_enums import RunbookState -from ._automation_client_enums import RunbookTypeEnum -from ._automation_client_enums import ScheduleDay -from ._automation_client_enums import ScheduleFrequency -from ._automation_client_enums import SkuNameEnum -from ._automation_client_enums import SourceType -from ._automation_client_enums import StreamType -from ._automation_client_enums import SyncType -from ._automation_client_enums import TagOperators -from ._automation_client_enums import TokenType -from ._automation_client_enums import WindowsUpdateClasses -from ._automation_client_enums import WorkerType +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + Activity, + ActivityListResult, + ActivityOutputType, + ActivityParameter, + ActivityParameterSet, + ActivityParameterValidationSet, + AdvancedSchedule, + AdvancedScheduleMonthlyOccurrence, + AgentRegistration, + AgentRegistrationKeys, + AgentRegistrationRegenerateKeyParameter, + AutomationAccount, + AutomationAccountCreateOrUpdateParameters, + AutomationAccountListResult, + AutomationAccountUpdateParameters, + AzureQueryProperties, + Certificate, + CertificateCreateOrUpdateParameters, + CertificateListResult, + CertificateUpdateParameters, + CollectionItemUpdateConfiguration, + Connection, + ConnectionCreateOrUpdateParameters, + ConnectionListResult, + ConnectionType, + ConnectionTypeAssociationProperty, + ConnectionTypeCreateOrUpdateParameters, + ConnectionTypeListResult, + ConnectionUpdateParameters, + ContentHash, + ContentLink, + ContentSource, + Credential, + CredentialCreateOrUpdateParameters, + CredentialListResult, + CredentialUpdateParameters, + DscCompilationJob, + DscCompilationJobCreateParameters, + DscCompilationJobListResult, + DscConfiguration, + DscConfigurationAssociationProperty, + DscConfigurationCreateOrUpdateParameters, + DscConfigurationListResult, + DscConfigurationParameter, + DscConfigurationUpdateParameters, + DscMetaConfiguration, + DscNode, + DscNodeConfiguration, + DscNodeConfigurationCreateOrUpdateParameters, + DscNodeConfigurationListResult, + DscNodeExtensionHandlerAssociationProperty, + DscNodeListResult, + DscNodeReport, + DscNodeReportListResult, + DscNodeUpdateParameters, + DscNodeUpdateParametersProperties, + DscReportError, + DscReportResource, + DscReportResourceNavigation, + ErrorResponse, + FieldDefinition, + HybridRunbookWorker, + HybridRunbookWorkerGroup, + HybridRunbookWorkerGroupUpdateParameters, + HybridRunbookWorkerGroupsListResult, + Job, + JobCollectionItem, + JobCreateParameters, + JobListResultV2, + JobNavigation, + JobSchedule, + JobScheduleCreateParameters, + JobScheduleListResult, + JobStream, + JobStreamListResult, + Key, + KeyListResult, + LinkedWorkspace, + LinuxProperties, + Module, + ModuleCreateOrUpdateParameters, + ModuleErrorInfo, + ModuleListResult, + ModuleUpdateParameters, + NodeCount, + NodeCountProperties, + NodeCounts, + NonAzureQueryProperties, + Operation, + OperationDisplay, + OperationListResult, + ProxyResource, + PythonPackageCreateParameters, + PythonPackageUpdateParameters, + Resource, + RunAsCredentialAssociationProperty, + Runbook, + RunbookAssociationProperty, + RunbookCreateOrUpdateDraftParameters, + RunbookCreateOrUpdateDraftProperties, + RunbookCreateOrUpdateParameters, + RunbookDraft, + RunbookDraftUndoEditResult, + RunbookListResult, + RunbookParameter, + RunbookUpdateParameters, + Schedule, + ScheduleAssociationProperty, + ScheduleCreateOrUpdateParameters, + ScheduleListResult, + ScheduleProperties, + ScheduleUpdateParameters, + Sku, + SoftareUpdateConfigurationRunTaskProperties, + SoftareUpdateConfigurationRunTasks, + SoftwareUpdateConfiguration, + SoftwareUpdateConfigurationCollectionItem, + SoftwareUpdateConfigurationListResult, + SoftwareUpdateConfigurationMachineRun, + SoftwareUpdateConfigurationMachineRunListResult, + SoftwareUpdateConfigurationRun, + SoftwareUpdateConfigurationRunListResult, + SoftwareUpdateConfigurationTasks, + SourceControl, + SourceControlCreateOrUpdateParameters, + SourceControlListResult, + SourceControlSecurityTokenProperties, + SourceControlSyncJob, + SourceControlSyncJobById, + SourceControlSyncJobCreateParameters, + SourceControlSyncJobListResult, + SourceControlSyncJobStream, + SourceControlSyncJobStreamById, + SourceControlSyncJobStreamsListBySyncJob, + SourceControlUpdateParameters, + Statistics, + StatisticsListResult, + TagSettingsProperties, + TargetProperties, + TaskProperties, + TestJob, + TestJobCreateParameters, + TrackedResource, + TypeField, + TypeFieldListResult, + UpdateConfiguration, + UpdateConfigurationNavigation, + Usage, + UsageCounterName, + UsageListResult, + Variable, + VariableCreateOrUpdateParameters, + VariableListResult, + VariableUpdateParameters, + Watcher, + WatcherListResult, + WatcherUpdateParameters, + Webhook, + WebhookCreateOrUpdateParameters, + WebhookListResult, + WebhookUpdateParameters, + WindowsProperties, +) + +from ._automation_client_enums import ( # type: ignore + AgentRegistrationKeyName, + AutomationAccountState, + AutomationKeyName, + AutomationKeyPermissions, + ContentSourceType, + CountType, + DscConfigurationState, + GroupTypeEnum, + HttpStatusCode, + JobProvisioningState, + JobStatus, + JobStreamType, + LinuxUpdateClasses, + ModuleProvisioningState, + OperatingSystemType, + ProvisioningState, + RunbookState, + RunbookTypeEnum, + ScheduleDay, + ScheduleFrequency, + SkuNameEnum, + SourceType, + StreamType, + SyncType, + TagOperators, + TokenType, + WindowsUpdateClasses, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -248,6 +232,7 @@ "CertificateCreateOrUpdateParameters", "CertificateListResult", "CertificateUpdateParameters", + "CollectionItemUpdateConfiguration", "Connection", "ConnectionCreateOrUpdateParameters", "ConnectionListResult", @@ -263,9 +248,6 @@ "CredentialCreateOrUpdateParameters", "CredentialListResult", "CredentialUpdateParameters", - "DeletedAutomationAccount", - "DeletedAutomationAccountListResult", - "Dimension", "DscCompilationJob", "DscCompilationJobCreateParameters", "DscCompilationJobListResult", @@ -289,19 +271,12 @@ "DscReportError", "DscReportResource", "DscReportResourceNavigation", - "EncryptionProperties", - "EncryptionPropertiesIdentity", "ErrorResponse", "FieldDefinition", - "GraphicalRunbookContent", "HybridRunbookWorker", - "HybridRunbookWorkerCreateParameters", "HybridRunbookWorkerGroup", - "HybridRunbookWorkerGroupCreateOrUpdateParameters", + "HybridRunbookWorkerGroupUpdateParameters", "HybridRunbookWorkerGroupsListResult", - "HybridRunbookWorkerMoveParameters", - "HybridRunbookWorkersListResult", - "Identity", "Job", "JobCollectionItem", "JobCreateParameters", @@ -314,11 +289,8 @@ "JobStreamListResult", "Key", "KeyListResult", - "KeyVaultProperties", "LinkedWorkspace", "LinuxProperties", - "LogSpecification", - "MetricSpecification", "Module", "ModuleCreateOrUpdateParameters", "ModuleErrorInfo", @@ -331,17 +303,9 @@ "Operation", "OperationDisplay", "OperationListResult", - "OperationPropertiesFormatServiceSpecification", - "PrivateEndpointConnection", - "PrivateEndpointConnectionListResult", - "PrivateEndpointProperty", - "PrivateLinkResource", - "PrivateLinkResourceListResult", - "PrivateLinkServiceConnectionStateProperty", "ProxyResource", "PythonPackageCreateParameters", "PythonPackageUpdateParameters", - "RawGraphicalRunbookContent", "Resource", "RunAsCredentialAssociationProperty", "Runbook", @@ -354,13 +318,15 @@ "RunbookListResult", "RunbookParameter", "RunbookUpdateParameters", - "SUCScheduleProperties", "Schedule", "ScheduleAssociationProperty", "ScheduleCreateOrUpdateParameters", "ScheduleListResult", + "ScheduleProperties", "ScheduleUpdateParameters", "Sku", + "SoftareUpdateConfigurationRunTaskProperties", + "SoftareUpdateConfigurationRunTasks", "SoftwareUpdateConfiguration", "SoftwareUpdateConfigurationCollectionItem", "SoftwareUpdateConfigurationListResult", @@ -368,8 +334,6 @@ "SoftwareUpdateConfigurationMachineRunListResult", "SoftwareUpdateConfigurationRun", "SoftwareUpdateConfigurationRunListResult", - "SoftwareUpdateConfigurationRunTaskProperties", - "SoftwareUpdateConfigurationRunTasks", "SoftwareUpdateConfigurationTasks", "SourceControl", "SourceControlCreateOrUpdateParameters", @@ -385,7 +349,6 @@ "SourceControlUpdateParameters", "Statistics", "StatisticsListResult", - "SystemData", "TagSettingsProperties", "TargetProperties", "TaskProperties", @@ -399,7 +362,6 @@ "Usage", "UsageCounterName", "UsageListResult", - "UserAssignedIdentitiesProperties", "Variable", "VariableCreateOrUpdateParameters", "VariableListResult", @@ -418,10 +380,7 @@ "AutomationKeyPermissions", "ContentSourceType", "CountType", - "CreatedByType", "DscConfigurationState", - "EncryptionKeySourceType", - "GraphRunbookType", "GroupTypeEnum", "HttpStatusCode", "JobProvisioningState", @@ -431,7 +390,6 @@ "ModuleProvisioningState", "OperatingSystemType", "ProvisioningState", - "ResourceIdentityType", "RunbookState", "RunbookTypeEnum", "ScheduleDay", @@ -443,7 +401,6 @@ "TagOperators", "TokenType", "WindowsUpdateClasses", - "WorkerType", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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 d1b234768c1e..2fd1e976b039 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 @@ -53,15 +53,6 @@ class CountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NODECONFIGURATION = "nodeconfiguration" -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - class DscConfigurationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the state of the configuration.""" @@ -70,20 +61,6 @@ class DscConfigurationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): PUBLISHED = "Published" -class EncryptionKeySourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Encryption Key Source.""" - - MICROSOFT_AUTOMATION = "Microsoft.Automation" - MICROSOFT_KEYVAULT = "Microsoft.Keyvault" - - -class GraphRunbookType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Runbook Type.""" - - GRAPH_POWER_SHELL = "GraphPowerShell" - GRAPH_POWER_SHELL_WORKFLOW = "GraphPowerShellWorkflow" - - class GroupTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the HybridWorkerGroup.""" @@ -141,7 +118,6 @@ 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): @@ -228,15 +204,6 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): RUNNING = "Running" -class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The identity type.""" - - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" - NONE = "None" - - class RunbookState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the state of the runbook.""" @@ -341,10 +308,3 @@ class WindowsUpdateClasses(str, Enum, metaclass=CaseInsensitiveEnumMeta): DEFINITION = "Definition" TOOLS = "Tools" UPDATES = "Updates" - - -class WorkerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the HybridWorker.""" - - HYBRID_V1 = "HybridV1" - HYBRID_V2 = "HybridV2" 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 fc62b1c71a21..f8f8cbb60d22 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 @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,21 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys -from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union +from typing import Any, Literal, 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 +from .._utils import serialization as _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Activity(_serialization.Model): @@ -67,8 +61,8 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin definition: Optional[str] = None, - parameter_sets: Optional[List["_models.ActivityParameterSet"]] = None, - output_types: Optional[List["_models.ActivityOutputType"]] = None, + parameter_sets: Optional[list["_models.ActivityParameterSet"]] = None, + output_types: Optional[list["_models.ActivityOutputType"]] = None, creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, @@ -92,7 +86,7 @@ def __init__( """ super().__init__(**kwargs) self.id = id - self.name = None + self.name: Optional[str] = None self.definition = definition self.parameter_sets = parameter_sets self.output_types = output_types @@ -116,7 +110,7 @@ class ActivityListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Activity"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Activity"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: Gets or sets a list of activities. @@ -215,7 +209,7 @@ def __init__( value_from_pipeline_by_property_name: Optional[bool] = None, value_from_remaining_arguments: Optional[bool] = None, description: Optional[str] = None, - validation_set: Optional[List["_models.ActivityParameterValidationSet"]] = None, + validation_set: Optional[list["_models.ActivityParameterValidationSet"]] = None, **kwargs: Any ) -> None: """ @@ -282,7 +276,7 @@ def __init__( self, *, name: Optional[str] = None, - parameters: Optional[List["_models.ActivityParameter"]] = None, + parameters: Optional[list["_models.ActivityParameter"]] = None, **kwargs: Any ) -> None: """ @@ -337,9 +331,9 @@ class AdvancedSchedule(_serialization.Model): def __init__( self, *, - week_days: Optional[List[str]] = None, - month_days: Optional[List[int]] = None, - monthly_occurrences: Optional[List["_models.AdvancedScheduleMonthlyOccurrence"]] = None, + week_days: Optional[list[str]] = None, + month_days: Optional[list[int]] = None, + monthly_occurrences: Optional[list["_models.AdvancedScheduleMonthlyOccurrence"]] = None, **kwargs: Any ) -> None: """ @@ -522,9 +516,9 @@ class Resource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None class TrackedResource(Resource): @@ -558,7 +552,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, location: Optional[str] = None, **kwargs: Any) -> None: + 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] @@ -570,7 +564,7 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, location: Optional[ self.location = location -class AutomationAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class AutomationAccount(TrackedResource): """Definition of the automation account type. Variables are only populated by the server, and will be ignored when sending a request. @@ -587,10 +581,6 @@ class AutomationAccount(TrackedResource): # pylint: disable=too-many-instance-a :vartype location: str :ivar etag: Gets or sets the etag of the resource. :vartype etag: str - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.automation.models.Identity - :ivar system_data: Resource system metadata. - :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar sku: Gets or sets the SKU of account. :vartype sku: ~azure.mgmt.automation.models.Sku :ivar last_modified_by: Gets or sets the last modified by. @@ -603,27 +593,12 @@ class AutomationAccount(TrackedResource): # pylint: disable=too-many-instance-a :vartype last_modified_time: ~datetime.datetime :ivar description: Gets or sets the description. :vartype description: str - :ivar encryption: Encryption properties for the automation account. - :vartype encryption: ~azure.mgmt.automation.models.EncryptionProperties - :ivar private_endpoint_connections: List of Automation operations supported by the Automation - resource provider. - :vartype private_endpoint_connections: - list[~azure.mgmt.automation.models.PrivateEndpointConnection] - :ivar public_network_access: Indicates whether traffic on the non-ARM endpoint (Webhook/Agent) - is allowed from the public internet. - :vartype public_network_access: bool - :ivar disable_local_auth: Indicates whether requests using non-AAD authentication are blocked. - :vartype disable_local_auth: bool - :ivar automation_hybrid_service_url: URL of automation hybrid service which is used for hybrid - worker on-boarding. - :vartype automation_hybrid_service_url: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, "state": {"readonly": True}, "creation_time": {"readonly": True}, "last_modified_time": {"readonly": True}, @@ -636,39 +611,23 @@ class AutomationAccount(TrackedResource): # pylint: disable=too-many-instance-a "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "identity": {"key": "identity", "type": "Identity"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "sku": {"key": "properties.sku", "type": "Sku"}, "last_modified_by": {"key": "properties.lastModifiedBy", "type": "str"}, "state": {"key": "properties.state", "type": "str"}, "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, "description": {"key": "properties.description", "type": "str"}, - "encryption": {"key": "properties.encryption", "type": "EncryptionProperties"}, - "private_endpoint_connections": { - "key": "properties.privateEndpointConnections", - "type": "[PrivateEndpointConnection]", - }, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "bool"}, - "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, - "automation_hybrid_service_url": {"key": "properties.automationHybridServiceUrl", "type": "str"}, } def __init__( self, *, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, location: Optional[str] = None, etag: Optional[str] = None, - identity: Optional["_models.Identity"] = None, sku: Optional["_models.Sku"] = None, last_modified_by: Optional[str] = None, description: Optional[str] = None, - encryption: Optional["_models.EncryptionProperties"] = None, - private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None, - public_network_access: Optional[bool] = None, - disable_local_auth: Optional[bool] = None, - automation_hybrid_service_url: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -678,45 +637,21 @@ def __init__( :paramtype location: str :keyword etag: Gets or sets the etag of the resource. :paramtype etag: str - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.automation.models.Identity :keyword sku: Gets or sets the SKU of account. :paramtype sku: ~azure.mgmt.automation.models.Sku :keyword last_modified_by: Gets or sets the last modified by. :paramtype last_modified_by: str :keyword description: Gets or sets the description. :paramtype description: str - :keyword encryption: Encryption properties for the automation account. - :paramtype encryption: ~azure.mgmt.automation.models.EncryptionProperties - :keyword private_endpoint_connections: List of Automation operations supported by the - Automation resource provider. - :paramtype private_endpoint_connections: - list[~azure.mgmt.automation.models.PrivateEndpointConnection] - :keyword public_network_access: Indicates whether traffic on the non-ARM endpoint - (Webhook/Agent) is allowed from the public internet. - :paramtype public_network_access: bool - :keyword disable_local_auth: Indicates whether requests using non-AAD authentication are - blocked. - :paramtype disable_local_auth: bool - :keyword automation_hybrid_service_url: URL of automation hybrid service which is used for - hybrid worker on-boarding. - :paramtype automation_hybrid_service_url: str """ super().__init__(tags=tags, location=location, **kwargs) self.etag = etag - self.identity = identity - self.system_data = None self.sku = sku self.last_modified_by = last_modified_by - self.state = None - self.creation_time = None - self.last_modified_time = None + self.state: Optional[Union[str, "_models.AutomationAccountState"]] = None + self.creation_time: Optional[datetime.datetime] = None + self.last_modified_time: Optional[datetime.datetime] = None self.description = description - self.encryption = encryption - self.private_endpoint_connections = private_endpoint_connections - self.public_network_access = public_network_access - self.disable_local_auth = disable_local_auth - self.automation_hybrid_service_url = automation_hybrid_service_url class AutomationAccountCreateOrUpdateParameters(_serialization.Model): # pylint: disable=name-too-long @@ -726,30 +661,17 @@ class AutomationAccountCreateOrUpdateParameters(_serialization.Model): # pylint :vartype name: str :ivar location: Gets or sets the location of the resource. :vartype location: str - :ivar identity: Sets the identity property for automation account. - :vartype identity: ~azure.mgmt.automation.models.Identity :ivar tags: Gets or sets the tags attached to the resource. :vartype tags: dict[str, str] :ivar sku: Gets or sets account SKU. :vartype sku: ~azure.mgmt.automation.models.Sku - :ivar encryption: Set the encryption properties for the automation account. - :vartype encryption: ~azure.mgmt.automation.models.EncryptionProperties - :ivar public_network_access: Indicates whether traffic on the non-ARM endpoint (Webhook/Agent) - is allowed from the public internet. - :vartype public_network_access: bool - :ivar disable_local_auth: Indicates whether requests using non-AAD authentication are blocked. - :vartype disable_local_auth: bool """ _attribute_map = { "name": {"key": "name", "type": "str"}, "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "Identity"}, "tags": {"key": "tags", "type": "{str}"}, "sku": {"key": "properties.sku", "type": "Sku"}, - "encryption": {"key": "properties.encryption", "type": "EncryptionProperties"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "bool"}, - "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, } def __init__( @@ -757,12 +679,8 @@ def __init__( *, name: Optional[str] = None, location: Optional[str] = None, - identity: Optional["_models.Identity"] = None, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, sku: Optional["_models.Sku"] = None, - encryption: Optional["_models.EncryptionProperties"] = None, - public_network_access: Optional[bool] = None, - disable_local_auth: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -770,30 +688,16 @@ def __init__( :paramtype name: str :keyword location: Gets or sets the location of the resource. :paramtype location: str - :keyword identity: Sets the identity property for automation account. - :paramtype identity: ~azure.mgmt.automation.models.Identity :keyword tags: Gets or sets the tags attached to the resource. :paramtype tags: dict[str, str] :keyword sku: Gets or sets account SKU. :paramtype sku: ~azure.mgmt.automation.models.Sku - :keyword encryption: Set the encryption properties for the automation account. - :paramtype encryption: ~azure.mgmt.automation.models.EncryptionProperties - :keyword public_network_access: Indicates whether traffic on the non-ARM endpoint - (Webhook/Agent) is allowed from the public internet. - :paramtype public_network_access: bool - :keyword disable_local_auth: Indicates whether requests using non-AAD authentication are - blocked. - :paramtype disable_local_auth: bool """ super().__init__(**kwargs) self.name = name self.location = location - self.identity = identity self.tags = tags self.sku = sku - self.encryption = encryption - self.public_network_access = public_network_access - self.disable_local_auth = disable_local_auth class AutomationAccountListResult(_serialization.Model): @@ -813,7 +717,7 @@ class AutomationAccountListResult(_serialization.Model): def __init__( self, *, - value: Optional[List["_models.AutomationAccount"]] = None, + value: Optional[list["_models.AutomationAccount"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: @@ -835,30 +739,17 @@ class AutomationAccountUpdateParameters(_serialization.Model): :vartype name: str :ivar location: Gets or sets the location of the resource. :vartype location: str - :ivar identity: Sets the identity property for automation account. - :vartype identity: ~azure.mgmt.automation.models.Identity :ivar tags: Gets or sets the tags attached to the resource. :vartype tags: dict[str, str] :ivar sku: Gets or sets account SKU. :vartype sku: ~azure.mgmt.automation.models.Sku - :ivar encryption: Set the encryption properties for the automation account. - :vartype encryption: ~azure.mgmt.automation.models.EncryptionProperties - :ivar public_network_access: Indicates whether traffic on the non-ARM endpoint (Webhook/Agent) - is allowed from the public internet. - :vartype public_network_access: bool - :ivar disable_local_auth: Indicates whether requests using non-AAD authentication are blocked. - :vartype disable_local_auth: bool """ _attribute_map = { "name": {"key": "name", "type": "str"}, "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "Identity"}, "tags": {"key": "tags", "type": "{str}"}, "sku": {"key": "properties.sku", "type": "Sku"}, - "encryption": {"key": "properties.encryption", "type": "EncryptionProperties"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "bool"}, - "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, } def __init__( @@ -866,12 +757,8 @@ def __init__( *, name: Optional[str] = None, location: Optional[str] = None, - identity: Optional["_models.Identity"] = None, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, sku: Optional["_models.Sku"] = None, - encryption: Optional["_models.EncryptionProperties"] = None, - public_network_access: Optional[bool] = None, - disable_local_auth: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -879,30 +766,16 @@ def __init__( :paramtype name: str :keyword location: Gets or sets the location of the resource. :paramtype location: str - :keyword identity: Sets the identity property for automation account. - :paramtype identity: ~azure.mgmt.automation.models.Identity :keyword tags: Gets or sets the tags attached to the resource. :paramtype tags: dict[str, str] :keyword sku: Gets or sets account SKU. :paramtype sku: ~azure.mgmt.automation.models.Sku - :keyword encryption: Set the encryption properties for the automation account. - :paramtype encryption: ~azure.mgmt.automation.models.EncryptionProperties - :keyword public_network_access: Indicates whether traffic on the non-ARM endpoint - (Webhook/Agent) is allowed from the public internet. - :paramtype public_network_access: bool - :keyword disable_local_auth: Indicates whether requests using non-AAD authentication are - blocked. - :paramtype disable_local_auth: bool """ super().__init__(**kwargs) self.name = name self.location = location - self.identity = identity self.tags = tags self.sku = sku - self.encryption = encryption - self.public_network_access = public_network_access - self.disable_local_auth = disable_local_auth class AzureQueryProperties(_serialization.Model): @@ -925,8 +798,8 @@ class AzureQueryProperties(_serialization.Model): def __init__( self, *, - scope: Optional[List[str]] = None, - locations: Optional[List[str]] = None, + scope: Optional[list[str]] = None, + locations: Optional[list[str]] = None, tag_settings: Optional["_models.TagSettingsProperties"] = None, **kwargs: Any ) -> None: @@ -1012,11 +885,11 @@ def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: :paramtype description: str """ super().__init__(**kwargs) - self.thumbprint = None - self.expiry_time = None - self.is_exportable = None - self.creation_time = None - self.last_modified_time = None + self.thumbprint: Optional[str] = None + self.expiry_time: Optional[datetime.datetime] = None + self.is_exportable: Optional[bool] = None + self.creation_time: Optional[datetime.datetime] = None + self.last_modified_time: Optional[datetime.datetime] = None self.description = description @@ -1095,7 +968,7 @@ class CertificateListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Certificate"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Certificate"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: Gets or sets a list of certificates. @@ -1134,6 +1007,42 @@ def __init__(self, *, name: Optional[str] = None, description: Optional[str] = N self.description = description +class CollectionItemUpdateConfiguration(_serialization.Model): + """object returned when requesting a collection of software update configuration. + + :ivar azure_virtual_machines: List of azure resource Ids for azure virtual machines targeted by + the software update configuration. + :vartype azure_virtual_machines: list[str] + :ivar duration: Maximum time allowed for the software update configuration run. Duration needs + to be specified using the format PT[n]H[n]M[n]S as per ISO8601. + :vartype duration: ~datetime.timedelta + """ + + _attribute_map = { + "azure_virtual_machines": {"key": "azureVirtualMachines", "type": "[str]"}, + "duration": {"key": "duration", "type": "duration"}, + } + + def __init__( + self, + *, + azure_virtual_machines: Optional[list[str]] = None, + duration: Optional[datetime.timedelta] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_virtual_machines: List of azure resource Ids for azure virtual machines targeted + by the software update configuration. + :paramtype azure_virtual_machines: list[str] + :keyword duration: Maximum time allowed for the software update configuration run. Duration + needs to be specified using the format PT[n]H[n]M[n]S as per ISO8601. + :paramtype duration: ~datetime.timedelta + """ + super().__init__(**kwargs) + self.azure_virtual_machines = azure_virtual_machines + self.duration = duration + + class Connection(ProxyResource): """Definition of the connection. @@ -1192,9 +1101,9 @@ def __init__( """ super().__init__(**kwargs) self.connection_type = connection_type - self.field_definition_values = None - self.creation_time = None - self.last_modified_time = None + self.field_definition_values: Optional[dict[str, str]] = None + self.creation_time: Optional[datetime.datetime] = None + self.last_modified_time: Optional[datetime.datetime] = None self.description = description @@ -1231,7 +1140,7 @@ def __init__( name: str, connection_type: "_models.ConnectionTypeAssociationProperty", description: Optional[str] = None, - field_definition_values: Optional[Dict[str, str]] = None, + field_definition_values: Optional[dict[str, str]] = None, **kwargs: Any ) -> None: """ @@ -1267,7 +1176,7 @@ class ConnectionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Connection"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Connection"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: Gets or sets a list of connection. @@ -1339,12 +1248,12 @@ def __init__( :paramtype description: str """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.is_global = is_global - self.field_definitions = None - self.creation_time = None + self.field_definitions: Optional[dict[str, "_models.FieldDefinition"]] = None + self.creation_time: Optional[datetime.datetime] = None self.last_modified_time = last_modified_time self.description = description @@ -1397,7 +1306,7 @@ def __init__( self, *, name: str, - field_definitions: Dict[str, "_models.FieldDefinition"], + field_definitions: dict[str, "_models.FieldDefinition"], is_global: Optional[bool] = None, **kwargs: Any ) -> None: @@ -1431,7 +1340,7 @@ class ConnectionTypeListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ConnectionType"]] = None, next_link: Optional[str] = None, **kwargs: Any + 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. @@ -1466,7 +1375,7 @@ def __init__( *, name: Optional[str] = None, description: Optional[str] = None, - field_definition_values: Optional[Dict[str, str]] = None, + field_definition_values: Optional[dict[str, str]] = None, **kwargs: Any ) -> None: """ @@ -1650,9 +1559,9 @@ def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: :paramtype description: str """ super().__init__(**kwargs) - self.user_name = None - self.creation_time = None - self.last_modified_time = None + self.user_name: Optional[str] = None + self.creation_time: Optional[datetime.datetime] = None + self.last_modified_time: Optional[datetime.datetime] = None self.description = description @@ -1719,7 +1628,7 @@ class CredentialListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Credential"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Credential"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: Gets or sets a list of credentials. @@ -1778,130 +1687,7 @@ def __init__( self.description = description -class DeletedAutomationAccount(_serialization.Model): - """Definition of the deleted automation account type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource id. - :vartype id: str - :ivar name: Gets or sets name of the resource. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :ivar location: Gets or sets the location of the resource. - :vartype location: str - :ivar automation_account_resource_id: Gets or sets the Automation Account Resource Id. - :vartype automation_account_resource_id: str - :ivar automation_account_id: Gets or sets the Automation Account Id. - :vartype automation_account_id: str - :ivar location_properties_location: Gets or sets the location of the resource. - :vartype location_properties_location: str - :ivar deletion_time: Gets the deletion time. - :vartype deletion_time: ~datetime.datetime - """ - - _validation = { - "deletion_time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "automation_account_resource_id": {"key": "properties.automationAccountResourceId", "type": "str"}, - "automation_account_id": {"key": "properties.automationAccountId", "type": "str"}, - "location_properties_location": {"key": "properties.location", "type": "str"}, - "deletion_time": {"key": "properties.deletionTime", "type": "iso-8601"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - location: Optional[str] = None, - automation_account_resource_id: Optional[str] = None, - automation_account_id: Optional[str] = None, - location_properties_location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The resource id. - :paramtype id: str - :keyword name: Gets or sets name of the resource. - :paramtype name: str - :keyword type: The resource type. - :paramtype type: str - :keyword location: Gets or sets the location of the resource. - :paramtype location: str - :keyword automation_account_resource_id: Gets or sets the Automation Account Resource Id. - :paramtype automation_account_resource_id: str - :keyword automation_account_id: Gets or sets the Automation Account Id. - :paramtype automation_account_id: str - :keyword location_properties_location: Gets or sets the location of the resource. - :paramtype location_properties_location: str - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.type = type - self.location = location - self.automation_account_resource_id = automation_account_resource_id - self.automation_account_id = automation_account_id - self.location_properties_location = location_properties_location - self.deletion_time = None - - -class DeletedAutomationAccountListResult(_serialization.Model): - """The response model for the list deleted automation account. - - :ivar value: Gets or sets the list of deleted automation accounts. - :vartype value: list[~azure.mgmt.automation.models.DeletedAutomationAccount] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DeletedAutomationAccount]"}, - } - - 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] - """ - super().__init__(**kwargs) - self.value = value - - -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 - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - } - - 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 - :keyword display_name: The display name of the dimension. - :paramtype display_name: str - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - - -class DscCompilationJob(ProxyResource): # pylint: disable=too-many-instance-attributes +class DscCompilationJob(ProxyResource): """Definition of the Dsc Compilation job. Variables are only populated by the server, and will be ignored when sending a request. @@ -1988,7 +1774,7 @@ def __init__( run_on: Optional[str] = None, status: Optional[Union[str, "_models.JobStatus"]] = None, status_details: Optional[str] = None, - parameters: Optional[Dict[str, str]] = None, + parameters: Optional[dict[str, str]] = None, **kwargs: Any ) -> None: """ @@ -2011,18 +1797,18 @@ def __init__( """ super().__init__(**kwargs) self.configuration = configuration - self.started_by = None - self.job_id = None - self.creation_time = None + self.started_by: Optional[str] = None + self.job_id: Optional[str] = None + self.creation_time: Optional[datetime.datetime] = None self.provisioning_state = provisioning_state self.run_on = run_on self.status = status self.status_details = status_details - self.start_time = None - self.end_time = None - self.exception = None - self.last_modified_time = None - self.last_status_modified_time = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None + self.exception: Optional[str] = None + self.last_modified_time: Optional[datetime.datetime] = None + self.last_status_modified_time: Optional[datetime.datetime] = None self.parameters = parameters @@ -2065,8 +1851,8 @@ def __init__( configuration: "_models.DscConfigurationAssociationProperty", name: Optional[str] = None, location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - parameters: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, + parameters: Optional[dict[str, str]] = None, increment_node_configuration_build: Optional[bool] = None, **kwargs: Any ) -> None: @@ -2111,7 +1897,7 @@ class DscCompilationJobListResult(_serialization.Model): def __init__( self, *, - value: Optional[List["_models.DscCompilationJob"]] = None, + value: Optional[list["_models.DscCompilationJob"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: @@ -2126,7 +1912,7 @@ def __init__( self.next_link = next_link -class DscConfiguration(TrackedResource): # pylint: disable=too-many-instance-attributes +class DscConfiguration(TrackedResource): """Definition of the configuration type. Variables are only populated by the server, and will be ignored when sending a request. @@ -2195,12 +1981,12 @@ class DscConfiguration(TrackedResource): # pylint: disable=too-many-instance-at def __init__( self, *, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, location: Optional[str] = None, etag: Optional[str] = None, provisioning_state: Optional[Literal["Succeeded"]] = None, job_count: Optional[int] = None, - parameters: Optional[Dict[str, "_models.DscConfigurationParameter"]] = None, + parameters: Optional[dict[str, "_models.DscConfigurationParameter"]] = None, source: Optional["_models.ContentSource"] = None, state: Optional[Union[str, "_models.DscConfigurationState"]] = None, log_verbose: Optional[bool] = None, @@ -2318,10 +2104,10 @@ def __init__( source: "_models.ContentSource", name: Optional[str] = None, location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, log_verbose: Optional[bool] = None, log_progress: Optional[bool] = None, - parameters: Optional[Dict[str, "_models.DscConfigurationParameter"]] = None, + parameters: Optional[dict[str, "_models.DscConfigurationParameter"]] = None, description: Optional[str] = None, **kwargs: Any ) -> None: @@ -2374,7 +2160,7 @@ class DscConfigurationListResult(_serialization.Model): def __init__( self, *, - value: Optional[List["_models.DscConfiguration"]] = None, + value: Optional[list["_models.DscConfiguration"]] = None, next_link: Optional[str] = None, total_count: Optional[int] = None, **kwargs: Any @@ -2474,11 +2260,11 @@ def __init__( self, *, name: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, log_verbose: Optional[bool] = None, log_progress: Optional[bool] = None, source: Optional["_models.ContentSource"] = None, - parameters: Optional[Dict[str, "_models.DscConfigurationParameter"]] = None, + parameters: Optional[dict[str, "_models.DscConfigurationParameter"]] = None, description: Optional[str] = None, **kwargs: Any ) -> None: @@ -2585,7 +2371,7 @@ def __init__( self.allow_module_overwrite = allow_module_overwrite -class DscNode(ProxyResource): # pylint: disable=too-many-instance-attributes +class DscNode(ProxyResource): """Definition of a DscNode. Variables are only populated by the server, and will be ignored when sending a request. @@ -2656,7 +2442,7 @@ def __init__( node_id: Optional[str] = None, etag: Optional[str] = None, total_count: Optional[int] = None, - extension_handler: Optional[List["_models.DscNodeExtensionHandlerAssociationProperty"]] = None, + extension_handler: Optional[list["_models.DscNodeExtensionHandlerAssociationProperty"]] = None, name_properties_node_configuration_name: Optional[str] = None, **kwargs: Any ) -> None: @@ -2804,7 +2590,7 @@ def __init__( self, *, name: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, source: Optional["_models.ContentSource"] = None, configuration: Optional["_models.DscConfigurationAssociationProperty"] = None, increment_node_configuration_build: Optional[bool] = None, @@ -2851,7 +2637,7 @@ class DscNodeConfigurationListResult(_serialization.Model): def __init__( self, *, - value: Optional[List["_models.DscNodeConfiguration"]] = None, + value: Optional[list["_models.DscNodeConfiguration"]] = None, next_link: Optional[str] = None, total_count: Optional[int] = None, **kwargs: Any @@ -2916,7 +2702,7 @@ class DscNodeListResult(_serialization.Model): def __init__( self, *, - value: Optional[List["_models.DscNode"]] = None, + value: Optional[list["_models.DscNode"]] = None, next_link: Optional[str] = None, total_count: Optional[int] = None, **kwargs: Any @@ -2935,7 +2721,7 @@ def __init__( self.total_count = total_count -class DscNodeReport(_serialization.Model): # pylint: disable=too-many-instance-attributes +class DscNodeReport(_serialization.Model): """Definition of the dsc node report type. :ivar end_time: Gets or sets the end time of the node report. @@ -3015,12 +2801,12 @@ def __init__( report_format_version: Optional[str] = None, configuration_version: Optional[str] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin - errors: Optional[List["_models.DscReportError"]] = None, - resources: Optional[List["_models.DscReportResource"]] = None, + errors: Optional[list["_models.DscReportError"]] = None, + resources: Optional[list["_models.DscReportResource"]] = None, meta_configuration: Optional["_models.DscMetaConfiguration"] = None, host_name: Optional[str] = None, - i_pv4_addresses: Optional[List[str]] = None, - i_pv6_addresses: Optional[List[str]] = None, + i_pv4_addresses: Optional[list[str]] = None, + i_pv6_addresses: Optional[list[str]] = None, number_of_resources: Optional[int] = None, raw_errors: Optional[str] = None, **kwargs: Any @@ -3103,7 +2889,7 @@ class DscNodeReportListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DscNodeReport"]] = None, next_link: Optional[str] = None, **kwargs: Any + 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. @@ -3272,7 +3058,7 @@ def __init__( *, resource_id: Optional[str] = None, source_info: Optional[str] = None, - depends_on: Optional[List["_models.DscReportResourceNavigation"]] = None, + depends_on: Optional[list["_models.DscReportResourceNavigation"]] = None, module_name: Optional[str] = None, module_version: Optional[str] = None, resource_name: Optional[str] = None, @@ -3338,71 +3124,6 @@ def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: self.resource_id = resource_id -class EncryptionProperties(_serialization.Model): - """The encryption settings for automation account. - - :ivar key_vault_properties: Key vault properties. - :vartype key_vault_properties: ~azure.mgmt.automation.models.KeyVaultProperties - :ivar key_source: Encryption Key Source. Known values are: "Microsoft.Automation" and - "Microsoft.Keyvault". - :vartype key_source: str or ~azure.mgmt.automation.models.EncryptionKeySourceType - :ivar identity: User identity used for CMK. - :vartype identity: ~azure.mgmt.automation.models.EncryptionPropertiesIdentity - """ - - _attribute_map = { - "key_vault_properties": {"key": "keyVaultProperties", "type": "KeyVaultProperties"}, - "key_source": {"key": "keySource", "type": "str"}, - "identity": {"key": "identity", "type": "EncryptionPropertiesIdentity"}, - } - - def __init__( - self, - *, - key_vault_properties: Optional["_models.KeyVaultProperties"] = None, - key_source: Optional[Union[str, "_models.EncryptionKeySourceType"]] = None, - identity: Optional["_models.EncryptionPropertiesIdentity"] = None, - **kwargs: Any - ) -> None: - """ - :keyword key_vault_properties: Key vault properties. - :paramtype key_vault_properties: ~azure.mgmt.automation.models.KeyVaultProperties - :keyword key_source: Encryption Key Source. Known values are: "Microsoft.Automation" and - "Microsoft.Keyvault". - :paramtype key_source: str or ~azure.mgmt.automation.models.EncryptionKeySourceType - :keyword identity: User identity used for CMK. - :paramtype identity: ~azure.mgmt.automation.models.EncryptionPropertiesIdentity - """ - super().__init__(**kwargs) - self.key_vault_properties = key_vault_properties - self.key_source = key_source - self.identity = identity - - -class EncryptionPropertiesIdentity(_serialization.Model): - """User identity used for CMK. - - :ivar user_assigned_identity: The user identity used for CMK. It will be an ARM resource id in - the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long - :vartype user_assigned_identity: JSON - """ - - _attribute_map = { - "user_assigned_identity": {"key": "userAssignedIdentity", "type": "object"}, - } - - 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: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long - :paramtype user_assigned_identity: JSON - """ - super().__init__(**kwargs) - self.user_assigned_identity = user_assigned_identity - - class ErrorResponse(_serialization.Model): """Error response of an operation failure. @@ -3469,230 +3190,103 @@ def __init__( self.type = type -class GraphicalRunbookContent(_serialization.Model): - """Graphical Runbook Content. - - :ivar raw_content: Raw graphical Runbook content. - :vartype raw_content: ~azure.mgmt.automation.models.RawGraphicalRunbookContent - :ivar graph_runbook_json: Graphical Runbook content as JSON. - :vartype graph_runbook_json: str - """ - - _attribute_map = { - "raw_content": {"key": "rawContent", "type": "RawGraphicalRunbookContent"}, - "graph_runbook_json": {"key": "graphRunbookJson", "type": "str"}, - } - - def __init__( - self, - *, - raw_content: Optional["_models.RawGraphicalRunbookContent"] = None, - graph_runbook_json: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword raw_content: Raw graphical Runbook content. - :paramtype raw_content: ~azure.mgmt.automation.models.RawGraphicalRunbookContent - :keyword graph_runbook_json: Graphical Runbook content as JSON. - :paramtype graph_runbook_json: str - """ - super().__init__(**kwargs) - self.raw_content = raw_content - self.graph_runbook_json = graph_runbook_json - - -class HybridRunbookWorker(Resource): +class HybridRunbookWorker(_serialization.Model): """Definition of hybrid runbook worker. - 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. + :ivar name: Gets or sets the worker machine name. :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Resource system metadata. - :vartype system_data: ~azure.mgmt.automation.models.SystemData :ivar ip: Gets or sets the assigned machine IP address. :vartype ip: str - :ivar registered_date_time: Gets or sets the registration time of the worker machine. - :vartype registered_date_time: ~datetime.datetime + :ivar registration_time: Gets or sets the registration time of the worker machine. + :vartype registration_time: ~datetime.datetime :ivar last_seen_date_time: Last Heartbeat from the Worker. :vartype last_seen_date_time: ~datetime.datetime - :ivar vm_resource_id: Azure Resource Manager Id for a virtual machine. - :vartype vm_resource_id: str - :ivar worker_type: Type of the HybridWorker. Known values are: "HybridV1" and "HybridV2". - :vartype worker_type: str or ~azure.mgmt.automation.models.WorkerType - :ivar worker_name: Name of the HybridWorker. - :vartype worker_name: 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"}, - "ip": {"key": "properties.ip", "type": "str"}, - "registered_date_time": {"key": "properties.registeredDateTime", "type": "iso-8601"}, - "last_seen_date_time": {"key": "properties.lastSeenDateTime", "type": "iso-8601"}, - "vm_resource_id": {"key": "properties.vmResourceId", "type": "str"}, - "worker_type": {"key": "properties.workerType", "type": "str"}, - "worker_name": {"key": "properties.workerName", "type": "str"}, + "ip": {"key": "ip", "type": "str"}, + "registration_time": {"key": "registrationTime", "type": "iso-8601"}, + "last_seen_date_time": {"key": "lastSeenDateTime", "type": "iso-8601"}, } def __init__( self, *, + name: Optional[str] = None, ip: Optional[str] = None, - registered_date_time: Optional[datetime.datetime] = None, + registration_time: Optional[datetime.datetime] = None, last_seen_date_time: Optional[datetime.datetime] = None, - vm_resource_id: Optional[str] = None, - worker_type: Optional[Union[str, "_models.WorkerType"]] = None, - worker_name: Optional[str] = None, **kwargs: Any ) -> None: """ + :keyword name: Gets or sets the worker machine name. + :paramtype name: str :keyword ip: Gets or sets the assigned machine IP address. :paramtype ip: str - :keyword registered_date_time: Gets or sets the registration time of the worker machine. - :paramtype registered_date_time: ~datetime.datetime + :keyword registration_time: Gets or sets the registration time of the worker machine. + :paramtype registration_time: ~datetime.datetime :keyword last_seen_date_time: Last Heartbeat from the Worker. :paramtype last_seen_date_time: ~datetime.datetime - :keyword vm_resource_id: Azure Resource Manager Id for a virtual machine. - :paramtype vm_resource_id: str - :keyword worker_type: Type of the HybridWorker. Known values are: "HybridV1" and "HybridV2". - :paramtype worker_type: str or ~azure.mgmt.automation.models.WorkerType - :keyword worker_name: Name of the HybridWorker. - :paramtype worker_name: str """ super().__init__(**kwargs) - self.system_data = None + self.name = name self.ip = ip - self.registered_date_time = registered_date_time + self.registration_time = registration_time self.last_seen_date_time = last_seen_date_time - self.vm_resource_id = vm_resource_id - self.worker_type = worker_type - self.worker_name = worker_name - - -class HybridRunbookWorkerCreateParameters(_serialization.Model): - """The parameters supplied to the create hybrid runbook worker operation. - - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar vm_resource_id: Azure Resource Manager Id for a virtual machine. - :vartype vm_resource_id: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "vm_resource_id": {"key": "properties.vmResourceId", "type": "str"}, - } - - 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 - :keyword vm_resource_id: Azure Resource Manager Id for a virtual machine. - :paramtype vm_resource_id: str - """ - super().__init__(**kwargs) - self.name = name - self.vm_resource_id = vm_resource_id -class HybridRunbookWorkerGroup(Resource): +class HybridRunbookWorkerGroup(_serialization.Model): """Definition of hybrid runbook worker 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. + :ivar id: Gets or sets the id of the resource. :vartype id: str - :ivar name: The name of the resource. + :ivar name: Gets or sets the name of the group. :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Resource system metadata. - :vartype system_data: ~azure.mgmt.automation.models.SystemData - :ivar group_type: Type of the HybridWorkerGroup. Known values are: "User" and "System". - :vartype group_type: str or ~azure.mgmt.automation.models.GroupTypeEnum + :ivar hybrid_runbook_workers: Gets or sets the list of hybrid runbook workers. + :vartype hybrid_runbook_workers: list[~azure.mgmt.automation.models.HybridRunbookWorker] :ivar credential: Sets the credential of a worker group. :vartype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty + :ivar group_type: Type of the HybridWorkerGroup. Known values are: "User" and "System". + :vartype group_type: str or ~azure.mgmt.automation.models.GroupTypeEnum """ - _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"}, - "group_type": {"key": "properties.groupType", "type": "str"}, - "credential": {"key": "properties.credential", "type": "RunAsCredentialAssociationProperty"}, - } - - def __init__( - self, - *, - group_type: Optional[Union[str, "_models.GroupTypeEnum"]] = None, - credential: Optional["_models.RunAsCredentialAssociationProperty"] = None, - **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 - :keyword credential: Sets the credential of a worker group. - :paramtype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty - """ - super().__init__(**kwargs) - self.system_data = None - self.group_type = group_type - self.credential = credential - - -class HybridRunbookWorkerGroupCreateOrUpdateParameters(_serialization.Model): # pylint: disable=name-too-long - """The parameters supplied to the create hybrid runbook worker group operation. - - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar credential: Sets the credential of a worker group. - :vartype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "credential": {"key": "properties.credential", "type": "RunAsCredentialAssociationProperty"}, + "hybrid_runbook_workers": {"key": "hybridRunbookWorkers", "type": "[HybridRunbookWorker]"}, + "credential": {"key": "credential", "type": "RunAsCredentialAssociationProperty"}, + "group_type": {"key": "groupType", "type": "str"}, } def __init__( self, *, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, + hybrid_runbook_workers: Optional[list["_models.HybridRunbookWorker"]] = None, credential: Optional["_models.RunAsCredentialAssociationProperty"] = None, + group_type: Optional[Union[str, "_models.GroupTypeEnum"]] = None, **kwargs: Any ) -> None: """ - :keyword name: Gets or sets the name of the resource. + :keyword id: Gets or sets the id of the resource. + :paramtype id: str + :keyword name: Gets or sets the name of the group. :paramtype name: str + :keyword hybrid_runbook_workers: Gets or sets the list of hybrid runbook workers. + :paramtype hybrid_runbook_workers: list[~azure.mgmt.automation.models.HybridRunbookWorker] :keyword credential: Sets the credential of a worker group. :paramtype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty + :keyword group_type: Type of the HybridWorkerGroup. Known values are: "User" and "System". + :paramtype group_type: str or ~azure.mgmt.automation.models.GroupTypeEnum """ super().__init__(**kwargs) + self.id = id self.name = name + self.hybrid_runbook_workers = hybrid_runbook_workers self.credential = credential + self.group_type = group_type class HybridRunbookWorkerGroupsListResult(_serialization.Model): @@ -3712,7 +3306,7 @@ class HybridRunbookWorkerGroupsListResult(_serialization.Model): def __init__( self, *, - value: Optional[List["_models.HybridRunbookWorkerGroup"]] = None, + value: Optional[list["_models.HybridRunbookWorkerGroup"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: @@ -3727,115 +3321,30 @@ def __init__( self.next_link = next_link -class HybridRunbookWorkerMoveParameters(_serialization.Model): - """Parameters supplied to move hybrid worker operation. +class HybridRunbookWorkerGroupUpdateParameters(_serialization.Model): + """Parameters supplied to the update operation. - :ivar hybrid_runbook_worker_group_name: Gets or sets the target hybrid runbook worker group. - :vartype hybrid_runbook_worker_group_name: str + :ivar credential: Sets the credential of a worker group. + :vartype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty """ _attribute_map = { - "hybrid_runbook_worker_group_name": {"key": "hybridRunbookWorkerGroupName", "type": "str"}, + "credential": {"key": "credential", "type": "RunAsCredentialAssociationProperty"}, } - def __init__(self, *, hybrid_runbook_worker_group_name: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, credential: Optional["_models.RunAsCredentialAssociationProperty"] = 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 + :keyword credential: Sets the credential of a worker group. + :paramtype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty """ super().__init__(**kwargs) - self.hybrid_runbook_worker_group_name = hybrid_runbook_worker_group_name + self.credential = credential -class HybridRunbookWorkersListResult(_serialization.Model): - """The response model for the list hybrid runbook workers. - - :ivar value: Gets or sets a list of hybrid runbook workers. - :vartype value: list[~azure.mgmt.automation.models.HybridRunbookWorker] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[HybridRunbookWorker]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - 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] - :keyword next_link: Gets or sets the next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Identity(_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 resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Known values are: "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned", and "None". - :vartype type: str or ~azure.mgmt.automation.models.ResourceIdentityType - :ivar user_assigned_identities: The list of user identities associated with the resource. The - user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.automation.models.UserAssignedIdentitiesProperties] - """ - - _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": "{UserAssignedIdentitiesProperties}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentitiesProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned", and "None". - :paramtype type: str or ~azure.mgmt.automation.models.ResourceIdentityType - :keyword user_assigned_identities: The list of user identities associated with the resource. - The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.automation.models.UserAssignedIdentitiesProperties] - """ - super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class Job(ProxyResource): # pylint: disable=too-many-instance-attributes - """Definition of the job. +class Job(ProxyResource): + """Definition of the job. Variables are only populated by the server, and will be ignored when sending a request. @@ -3920,7 +3429,7 @@ def __init__( exception: Optional[str] = None, last_modified_time: Optional[datetime.datetime] = None, last_status_modified_time: Optional[datetime.datetime] = None, - parameters: Optional[Dict[str, str]] = None, + parameters: Optional[dict[str, str]] = None, provisioning_state: Optional[Union[str, "_models.JobProvisioningState"]] = None, **kwargs: Any ) -> None: @@ -3975,7 +3484,7 @@ def __init__( self.provisioning_state = provisioning_state -class JobCollectionItem(ProxyResource): # pylint: disable=too-many-instance-attributes +class JobCollectionItem(ProxyResource): """Job collection item properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -4043,14 +3552,14 @@ def __init__(self, *, run_on: Optional[str] = None, **kwargs: Any) -> None: :paramtype run_on: str """ super().__init__(**kwargs) - self.runbook = None - self.job_id = None - self.creation_time = None - self.status = None - self.start_time = None - self.end_time = None - self.last_modified_time = None - self.provisioning_state = None + self.runbook: Optional["_models.RunbookAssociationProperty"] = None + self.job_id: Optional[str] = None + self.creation_time: Optional[datetime.datetime] = None + self.status: Optional[Union[str, "_models.JobStatus"]] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None + self.last_modified_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None self.run_on = run_on @@ -4076,7 +3585,7 @@ def __init__( self, *, runbook: Optional["_models.RunbookAssociationProperty"] = None, - parameters: Optional[Dict[str, str]] = None, + parameters: Optional[dict[str, str]] = None, run_on: Optional[str] = None, **kwargs: Any ) -> None: @@ -4115,14 +3624,14 @@ class JobListResultV2(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobCollectionItem"]] = None, **kwargs: Any) -> None: + 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] """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class JobNavigation(_serialization.Model): @@ -4145,7 +3654,7 @@ class JobNavigation(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class JobSchedule(_serialization.Model): @@ -4195,7 +3704,7 @@ def __init__( schedule: Optional["_models.ScheduleAssociationProperty"] = None, runbook: Optional["_models.RunbookAssociationProperty"] = None, run_on: Optional[str] = None, - parameters: Optional[Dict[str, str]] = None, + parameters: Optional[dict[str, str]] = None, **kwargs: Any ) -> None: """ @@ -4211,9 +3720,9 @@ def __init__( :paramtype parameters: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.job_schedule_id = job_schedule_id self.schedule = schedule self.runbook = runbook @@ -4254,7 +3763,7 @@ def __init__( schedule: "_models.ScheduleAssociationProperty", runbook: "_models.RunbookAssociationProperty", run_on: Optional[str] = None, - parameters: Optional[Dict[str, str]] = None, + parameters: Optional[dict[str, str]] = None, **kwargs: Any ) -> None: """ @@ -4289,7 +3798,7 @@ class JobScheduleListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.JobSchedule"]] = None, next_link: Optional[str] = None, **kwargs: Any + 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. @@ -4341,7 +3850,7 @@ def __init__( stream_type: Optional[Union[str, "_models.JobStreamType"]] = None, stream_text: Optional[str] = None, summary: Optional[str] = None, - value: Optional[Dict[str, JSON]] = None, + value: Optional[dict[str, JSON]] = None, **kwargs: Any ) -> None: """ @@ -4386,7 +3895,7 @@ class JobStreamListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.JobStream"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.JobStream"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: A list of job streams. @@ -4427,9 +3936,9 @@ class Key(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.key_name = None - self.permissions = None - self.value = None + self.key_name: Optional[Union[str, "_models.AutomationKeyName"]] = None + self.permissions: Optional[Union[str, "_models.AutomationKeyPermissions"]] = None + self.value: Optional[str] = None class KeyListResult(_serialization.Model): @@ -4443,7 +3952,7 @@ class KeyListResult(_serialization.Model): "keys": {"key": "keys", "type": "[Key]"}, } - def __init__(self, *, keys: Optional[List["_models.Key"]] = None, **kwargs: Any) -> None: + 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] @@ -4452,45 +3961,6 @@ def __init__(self, *, keys: Optional[List["_models.Key"]] = None, **kwargs: Any) self.keys = keys -class KeyVaultProperties(_serialization.Model): - """Settings concerning key vault encryption for a configuration store. - - :ivar keyvault_uri: The URI of the key vault key used to encrypt data. - :vartype keyvault_uri: str - :ivar key_name: The name of key used to encrypt data. - :vartype key_name: str - :ivar key_version: The key version of the key used to encrypt data. - :vartype key_version: str - """ - - _attribute_map = { - "keyvault_uri": {"key": "keyvaultUri", "type": "str"}, - "key_name": {"key": "keyName", "type": "str"}, - "key_version": {"key": "keyVersion", "type": "str"}, - } - - def __init__( - self, - *, - keyvault_uri: Optional[str] = None, - key_name: Optional[str] = None, - key_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword keyvault_uri: The URI of the key vault key used to encrypt data. - :paramtype keyvault_uri: str - :keyword key_name: The name of key used to encrypt data. - :paramtype key_name: str - :keyword key_version: The key version of the key used to encrypt data. - :paramtype key_version: str - """ - super().__init__(**kwargs) - self.keyvault_uri = keyvault_uri - self.key_name = key_name - self.key_version = key_version - - class LinkedWorkspace(_serialization.Model): """Definition of the linked workspace. @@ -4511,7 +3981,7 @@ class LinkedWorkspace(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class LinuxProperties(_serialization.Model): @@ -4540,8 +4010,8 @@ def __init__( self, *, included_package_classifications: Optional[Union[str, "_models.LinuxUpdateClasses"]] = None, - excluded_package_name_masks: Optional[List[str]] = None, - included_package_name_masks: Optional[List[str]] = None, + excluded_package_name_masks: Optional[list[str]] = None, + included_package_name_masks: Optional[list[str]] = None, reboot_setting: Optional[str] = None, **kwargs: Any ) -> None: @@ -4564,106 +4034,7 @@ def __init__( self.reboot_setting = reboot_setting -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 MetricSpecification(_serialization.Model): - """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 dimensions: List of dimensions. - :vartype dimensions: list[~azure.mgmt.automation.models.Dimension] - """ - - _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"}, - "dimensions": {"key": "dimensions", "type": "[Dimension]"}, - } - - 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, - dimensions: Optional[List["_models.Dimension"]] = 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 dimensions: List of dimensions. - :paramtype dimensions: list[~azure.mgmt.automation.models.Dimension] - """ - 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.dimensions = dimensions - - -class Module(TrackedResource): # pylint: disable=too-many-instance-attributes +class Module(TrackedResource): """Definition of the module type. Variables are only populated by the server, and will be ignored when sending a request. @@ -4737,7 +4108,7 @@ class Module(TrackedResource): # pylint: disable=too-many-instance-attributes def __init__( self, *, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, location: Optional[str] = None, etag: Optional[str] = None, is_global: Optional[bool] = None, @@ -4834,7 +4205,7 @@ def __init__( content_link: "_models.ContentLink", name: Optional[str] = None, location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, **kwargs: Any ) -> None: """ @@ -4895,7 +4266,7 @@ class ModuleListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Module"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Module"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: Gets or sets a list of modules. @@ -4933,7 +4304,7 @@ def __init__( *, name: Optional[str] = None, location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, content_link: Optional["_models.ContentLink"] = None, **kwargs: Any ) -> None: @@ -5017,7 +4388,7 @@ class NodeCounts(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.NodeCount"]] = None, total_count: Optional[int] = None, **kwargs: Any + self, *, value: Optional[list["_models.NodeCount"]] = None, total_count: Optional[int] = None, **kwargs: Any ) -> None: """ :keyword value: Gets an array of counts. @@ -5065,48 +4436,25 @@ class Operation(_serialization.Model): :vartype name: str :ivar display: Provider, Resource and Operation values. :vartype display: ~azure.mgmt.automation.models.OperationDisplay - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar service_specification: Specification of the service. - :vartype service_specification: - ~azure.mgmt.automation.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 + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str :keyword display: Provider, Resource and Operation values. :paramtype display: ~azure.mgmt.automation.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword service_specification: Specification of the service. - :paramtype service_specification: - ~azure.mgmt.automation.models.OperationPropertiesFormatServiceSpecification """ super().__init__(**kwargs) self.name = name self.display = display - self.origin = origin - self.service_specification = service_specification class OperationDisplay(_serialization.Model): @@ -5118,15 +4466,12 @@ class OperationDisplay(_serialization.Model): :vartype resource: str :ivar operation: Operation type: Read, write, 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__( @@ -5135,7 +4480,6 @@ def __init__( provider: Optional[str] = None, resource: Optional[str] = None, operation: Optional[str] = None, - description: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -5145,14 +4489,11 @@ def __init__( :paramtype resource: str :keyword operation: Operation type: Read, write, 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): @@ -5166,7 +4507,7 @@ class OperationListResult(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs: Any) -> None: + 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] @@ -5175,238 +4516,6 @@ def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwarg self.value = value -class OperationPropertiesFormatServiceSpecification(_serialization.Model): # pylint: disable=name-too-long - """Specification of the service. - - :ivar metric_specifications: Operation service specification. - :vartype metric_specifications: list[~azure.mgmt.automation.models.MetricSpecification] - :ivar log_specifications: Operation log specification. - :vartype log_specifications: list[~azure.mgmt.automation.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.automation.models.MetricSpecification] - :keyword log_specifications: Operation log specification. - :paramtype log_specifications: list[~azure.mgmt.automation.models.LogSpecification] - """ - super().__init__(**kwargs) - self.metric_specifications = metric_specifications - self.log_specifications = log_specifications - - -class PrivateEndpointConnection(ProxyResource): - """A private endpoint connection. - - 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 private_endpoint: Private endpoint which the connection belongs to. - :vartype private_endpoint: ~azure.mgmt.automation.models.PrivateEndpointProperty - :ivar group_ids: Gets the groupIds. - :vartype group_ids: list[str] - :ivar private_link_service_connection_state: Connection State of the Private Endpoint - Connection. - :vartype private_link_service_connection_state: - ~azure.mgmt.automation.models.PrivateLinkServiceConnectionStateProperty - """ - - _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"}, - "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpointProperty"}, - "group_ids": {"key": "properties.groupIds", "type": "[str]"}, - "private_link_service_connection_state": { - "key": "properties.privateLinkServiceConnectionState", - "type": "PrivateLinkServiceConnectionStateProperty", - }, - } - - def __init__( - self, - *, - private_endpoint: Optional["_models.PrivateEndpointProperty"] = None, - group_ids: Optional[List[str]] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None, - **kwargs: Any - ) -> None: - """ - :keyword private_endpoint: Private endpoint which the connection belongs to. - :paramtype private_endpoint: ~azure.mgmt.automation.models.PrivateEndpointProperty - :keyword group_ids: Gets the groupIds. - :paramtype group_ids: list[str] - :keyword private_link_service_connection_state: Connection State of the Private Endpoint - Connection. - :paramtype private_link_service_connection_state: - ~azure.mgmt.automation.models.PrivateLinkServiceConnectionStateProperty - """ - super().__init__(**kwargs) - self.private_endpoint = private_endpoint - self.group_ids = group_ids - self.private_link_service_connection_state = private_link_service_connection_state - - -class PrivateEndpointConnectionListResult(_serialization.Model): - """A list of private endpoint connections. - - :ivar value: Array of private endpoint connections. - :vartype value: list[~azure.mgmt.automation.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.automation.models.PrivateEndpointConnection] - """ - super().__init__(**kwargs) - self.value = value - - -class PrivateEndpointProperty(_serialization.Model): - """Private endpoint which the connection belongs to. - - :ivar id: 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: Resource id of the private endpoint. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class PrivateLinkResource(ProxyResource): - """A private link 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 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] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"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"}, - "type": {"key": "type", "type": "str"}, - "group_id": {"key": "properties.groupId", "type": "str"}, - "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.group_id = None - self.required_members = None - - -class PrivateLinkResourceListResult(_serialization.Model): - """A list of private link resources. - - :ivar value: Array of private link resources. - :vartype value: list[~azure.mgmt.automation.models.PrivateLinkResource] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateLinkResource]"}, - } - - 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] - """ - super().__init__(**kwargs) - self.value = value - - -class PrivateLinkServiceConnectionStateProperty(_serialization.Model): # pylint: disable=name-too-long - """Connection State of the Private Endpoint Connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The private link service connection status. - :vartype status: str - :ivar description: The private link service connection description. - :vartype description: str - :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ - disconnect). - :vartype actions_required: str - """ - - _validation = { - "actions_required": {"readonly": True}, - } - - _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, **kwargs: Any) -> None: - """ - :keyword status: The private link service connection status. - :paramtype status: str - :keyword description: The private link service connection description. - :paramtype description: str - """ - super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = None - - class PythonPackageCreateParameters(_serialization.Model): """The parameters supplied to the create or update module operation. @@ -5428,7 +4537,7 @@ class PythonPackageCreateParameters(_serialization.Model): } def __init__( - self, *, content_link: "_models.ContentLink", tags: Optional[Dict[str, str]] = None, **kwargs: Any + 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. @@ -5452,7 +4561,7 @@ class PythonPackageUpdateParameters(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + 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] @@ -5461,47 +4570,6 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N self.tags = tags -class RawGraphicalRunbookContent(_serialization.Model): - """Raw Graphical Runbook content. - - :ivar schema_version: Schema version of the serializer. - :vartype schema_version: str - :ivar runbook_definition: Serialized Graphical runbook. - :vartype runbook_definition: str - :ivar runbook_type: Runbook Type. Known values are: "GraphPowerShell" and - "GraphPowerShellWorkflow". - :vartype runbook_type: str or ~azure.mgmt.automation.models.GraphRunbookType - """ - - _attribute_map = { - "schema_version": {"key": "schemaVersion", "type": "str"}, - "runbook_definition": {"key": "runbookDefinition", "type": "str"}, - "runbook_type": {"key": "runbookType", "type": "str"}, - } - - def __init__( - self, - *, - schema_version: Optional[str] = None, - runbook_definition: Optional[str] = None, - runbook_type: Optional[Union[str, "_models.GraphRunbookType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword schema_version: Schema version of the serializer. - :paramtype schema_version: str - :keyword runbook_definition: Serialized Graphical runbook. - :paramtype runbook_definition: str - :keyword runbook_type: Runbook Type. Known values are: "GraphPowerShell" and - "GraphPowerShellWorkflow". - :paramtype runbook_type: str or ~azure.mgmt.automation.models.GraphRunbookType - """ - super().__init__(**kwargs) - self.schema_version = schema_version - self.runbook_definition = runbook_definition - self.runbook_type = runbook_type - - class RunAsCredentialAssociationProperty(_serialization.Model): """Definition of RunAs credential to use for hybrid worker. @@ -5522,7 +4590,7 @@ def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: self.name = name -class Runbook(TrackedResource): # pylint: disable=too-many-instance-attributes +class Runbook(TrackedResource): """Definition of the runbook type. Variables are only populated by the server, and will be ignored when sending a request. @@ -5608,7 +4676,7 @@ class Runbook(TrackedResource): # pylint: disable=too-many-instance-attributes def __init__( self, *, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, location: Optional[str] = None, etag: Optional[str] = None, runbook_type: Optional[Union[str, "_models.RunbookTypeEnum"]] = None, @@ -5618,8 +4686,8 @@ def __init__( log_progress: Optional[bool] = None, log_activity_trace: Optional[int] = None, job_count: Optional[int] = None, - parameters: Optional[Dict[str, "_models.RunbookParameter"]] = None, - output_types: Optional[List[str]] = None, + parameters: Optional[dict[str, "_models.RunbookParameter"]] = None, + output_types: Optional[list[str]] = None, draft: Optional["_models.RunbookDraft"] = None, provisioning_state: Optional[Literal["Succeeded"]] = None, last_modified_by: Optional[str] = None, @@ -5858,7 +4926,7 @@ def __init__( runbook_type: Union[str, "_models.RunbookTypeEnum"], name: Optional[str] = None, location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, log_verbose: Optional[bool] = None, log_progress: Optional[bool] = None, draft: Optional["_models.RunbookDraft"] = None, @@ -5937,8 +5005,8 @@ def __init__( draft_content_link: Optional["_models.ContentLink"] = None, creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, - parameters: Optional[Dict[str, "_models.RunbookParameter"]] = None, - output_types: Optional[List[str]] = None, + parameters: Optional[dict[str, "_models.RunbookParameter"]] = None, + output_types: Optional[list[str]] = None, **kwargs: Any ) -> None: """ @@ -5976,7 +5044,7 @@ class RunbookDraftUndoEditResult(_serialization.Model): "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", - "HttpVersionNotSupported", and "Continue". + and "HttpVersionNotSupported". :vartype status_code: str or ~azure.mgmt.automation.models.HttpStatusCode :ivar request_id: :vartype request_id: str @@ -6004,7 +5072,7 @@ def __init__( "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", - "HttpVersionNotSupported", and "Continue". + and "HttpVersionNotSupported". :paramtype status_code: str or ~azure.mgmt.automation.models.HttpStatusCode :keyword request_id: :paramtype request_id: str @@ -6029,7 +5097,7 @@ class RunbookListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Runbook"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Runbook"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: Gets or sets a list of runbooks. @@ -6124,7 +5192,7 @@ def __init__( *, name: Optional[str] = None, location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, description: Optional[str] = None, log_verbose: Optional[bool] = None, log_progress: Optional[bool] = None, @@ -6157,7 +5225,7 @@ def __init__( self.log_activity_trace = log_activity_trace -class Schedule(ProxyResource): # pylint: disable=too-many-instance-attributes +class Schedule(ProxyResource): """Definition of the schedule. Variables are only populated by the server, and will be ignored when sending a request. @@ -6275,7 +5343,7 @@ def __init__( """ super().__init__(**kwargs) self.start_time = start_time - self.start_time_offset_minutes = None + self.start_time_offset_minutes: Optional[float] = None self.expiry_time = expiry_time self.expiry_time_offset_minutes = expiry_time_offset_minutes self.is_enabled = is_enabled @@ -6409,7 +5477,7 @@ class ScheduleListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Schedule"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Schedule"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: Gets or sets a list of schedules. @@ -6422,6 +5490,127 @@ def __init__( self.next_link = next_link +class ScheduleProperties(_serialization.Model): + """Definition of schedule parameters. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar start_time: Gets or sets the start time of the schedule. + :vartype start_time: ~datetime.datetime + :ivar start_time_offset_minutes: Gets the start time's offset in minutes. + :vartype start_time_offset_minutes: float + :ivar expiry_time: Gets or sets the end time of the schedule. + :vartype expiry_time: ~datetime.datetime + :ivar expiry_time_offset_minutes: Gets or sets the expiry time's offset in minutes. + :vartype expiry_time_offset_minutes: float + :ivar is_enabled: Gets or sets a value indicating whether this schedule is enabled. + :vartype is_enabled: bool + :ivar next_run: Gets or sets the next run time of the schedule. + :vartype next_run: ~datetime.datetime + :ivar next_run_offset_minutes: Gets or sets the next run time's offset in minutes. + :vartype next_run_offset_minutes: float + :ivar interval: Gets or sets the interval of the schedule. + :vartype interval: int + :ivar frequency: Gets or sets the frequency of the schedule. Known values are: "OneTime", + "Day", "Hour", "Week", "Month", and "Minute". + :vartype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency + :ivar time_zone: Gets or sets the time zone of the schedule. + :vartype time_zone: str + :ivar advanced_schedule: Gets or sets the advanced schedule. + :vartype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule + :ivar creation_time: Gets or sets the creation time. + :vartype creation_time: ~datetime.datetime + :ivar last_modified_time: Gets or sets the last modified time. + :vartype last_modified_time: ~datetime.datetime + :ivar description: Gets or sets the description. + :vartype description: str + """ + + _validation = { + "start_time_offset_minutes": {"readonly": True}, + } + + _attribute_map = { + "start_time": {"key": "startTime", "type": "iso-8601"}, + "start_time_offset_minutes": {"key": "startTimeOffsetMinutes", "type": "float"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "expiry_time_offset_minutes": {"key": "expiryTimeOffsetMinutes", "type": "float"}, + "is_enabled": {"key": "isEnabled", "type": "bool"}, + "next_run": {"key": "nextRun", "type": "iso-8601"}, + "next_run_offset_minutes": {"key": "nextRunOffsetMinutes", "type": "float"}, + "interval": {"key": "interval", "type": "int"}, + "frequency": {"key": "frequency", "type": "str"}, + "time_zone": {"key": "timeZone", "type": "str"}, + "advanced_schedule": {"key": "advancedSchedule", "type": "AdvancedSchedule"}, + "creation_time": {"key": "creationTime", "type": "iso-8601"}, + "last_modified_time": {"key": "lastModifiedTime", "type": "iso-8601"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + expiry_time: Optional[datetime.datetime] = None, + expiry_time_offset_minutes: Optional[float] = None, + is_enabled: bool = False, + next_run: Optional[datetime.datetime] = None, + next_run_offset_minutes: Optional[float] = None, + interval: Optional[int] = None, + frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = None, + time_zone: Optional[str] = None, + advanced_schedule: Optional["_models.AdvancedSchedule"] = None, + creation_time: Optional[datetime.datetime] = None, + last_modified_time: Optional[datetime.datetime] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword start_time: Gets or sets the start time of the schedule. + :paramtype start_time: ~datetime.datetime + :keyword expiry_time: Gets or sets the end time of the schedule. + :paramtype expiry_time: ~datetime.datetime + :keyword expiry_time_offset_minutes: Gets or sets the expiry time's offset in minutes. + :paramtype expiry_time_offset_minutes: float + :keyword is_enabled: Gets or sets a value indicating whether this schedule is enabled. + :paramtype is_enabled: bool + :keyword next_run: Gets or sets the next run time of the schedule. + :paramtype next_run: ~datetime.datetime + :keyword next_run_offset_minutes: Gets or sets the next run time's offset in minutes. + :paramtype next_run_offset_minutes: float + :keyword interval: Gets or sets the interval of the schedule. + :paramtype interval: int + :keyword frequency: Gets or sets the frequency of the schedule. Known values are: "OneTime", + "Day", "Hour", "Week", "Month", and "Minute". + :paramtype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency + :keyword time_zone: Gets or sets the time zone of the schedule. + :paramtype time_zone: str + :keyword advanced_schedule: Gets or sets the advanced schedule. + :paramtype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule + :keyword creation_time: Gets or sets the creation time. + :paramtype creation_time: ~datetime.datetime + :keyword last_modified_time: Gets or sets the last modified time. + :paramtype last_modified_time: ~datetime.datetime + :keyword description: Gets or sets the description. + :paramtype description: str + """ + super().__init__(**kwargs) + self.start_time = start_time + self.start_time_offset_minutes: Optional[float] = None + self.expiry_time = expiry_time + self.expiry_time_offset_minutes = expiry_time_offset_minutes + self.is_enabled = is_enabled + self.next_run = next_run + self.next_run_offset_minutes = next_run_offset_minutes + self.interval = interval + self.frequency = frequency + self.time_zone = time_zone + self.advanced_schedule = advanced_schedule + self.creation_time = creation_time + self.last_modified_time = last_modified_time + self.description = description + + class ScheduleUpdateParameters(_serialization.Model): """The parameters supplied to the update schedule operation. @@ -6488,27 +5677,93 @@ class Sku(_serialization.Model): def __init__( self, *, - name: Union[str, "_models.SkuNameEnum"], - family: Optional[str] = None, - capacity: Optional[int] = None, + name: Union[str, "_models.SkuNameEnum"], + family: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Gets or sets the SKU name of the account. Required. Known values are: "Free" and + "Basic". + :paramtype name: str or ~azure.mgmt.automation.models.SkuNameEnum + :keyword family: Gets or sets the SKU family. + :paramtype family: str + :keyword capacity: Gets or sets the SKU capacity. + :paramtype capacity: int + """ + super().__init__(**kwargs) + self.name = name + self.family = family + self.capacity = capacity + + +class SoftareUpdateConfigurationRunTaskProperties(_serialization.Model): # pylint: disable=name-too-long + """Task properties of the software update configuration. + + :ivar status: The status of the task. + :vartype status: str + :ivar source: The name of the source of the task. + :vartype source: str + :ivar job_id: The job id of the task. + :vartype job_id: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "source": {"key": "source", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, + } + + def __init__( + 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 + :keyword source: The name of the source of the task. + :paramtype source: str + :keyword job_id: The job id of the task. + :paramtype job_id: str + """ + super().__init__(**kwargs) + self.status = status + self.source = source + self.job_id = job_id + + +class SoftareUpdateConfigurationRunTasks(_serialization.Model): + """Software update configuration run tasks model. + + :ivar pre_task: Pre task properties. + :vartype pre_task: ~azure.mgmt.automation.models.SoftareUpdateConfigurationRunTaskProperties + :ivar post_task: Post task properties. + :vartype post_task: ~azure.mgmt.automation.models.SoftareUpdateConfigurationRunTaskProperties + """ + + _attribute_map = { + "pre_task": {"key": "preTask", "type": "SoftareUpdateConfigurationRunTaskProperties"}, + "post_task": {"key": "postTask", "type": "SoftareUpdateConfigurationRunTaskProperties"}, + } + + def __init__( + self, + *, + pre_task: Optional["_models.SoftareUpdateConfigurationRunTaskProperties"] = None, + post_task: Optional["_models.SoftareUpdateConfigurationRunTaskProperties"] = None, **kwargs: Any ) -> None: """ - :keyword name: Gets or sets the SKU name of the account. Required. Known values are: "Free" and - "Basic". - :paramtype name: str or ~azure.mgmt.automation.models.SkuNameEnum - :keyword family: Gets or sets the SKU family. - :paramtype family: str - :keyword capacity: Gets or sets the SKU capacity. - :paramtype capacity: int + :keyword pre_task: Pre task properties. + :paramtype pre_task: ~azure.mgmt.automation.models.SoftareUpdateConfigurationRunTaskProperties + :keyword post_task: Post task properties. + :paramtype post_task: ~azure.mgmt.automation.models.SoftareUpdateConfigurationRunTaskProperties """ super().__init__(**kwargs) - self.name = name - self.family = family - self.capacity = capacity + self.pre_task = pre_task + self.post_task = post_task -class SoftwareUpdateConfiguration(_serialization.Model): # pylint: disable=too-many-instance-attributes +class SoftwareUpdateConfiguration(_serialization.Model): """Software update configuration properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -6525,7 +5780,7 @@ class SoftwareUpdateConfiguration(_serialization.Model): # pylint: disable=too- Required. :vartype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration :ivar schedule_info: Schedule information for the Software update configuration. Required. - :vartype schedule_info: ~azure.mgmt.automation.models.SUCScheduleProperties + :vartype schedule_info: ~azure.mgmt.automation.models.ScheduleProperties :ivar provisioning_state: Provisioning state for the software update configuration, which only appears in the response. :vartype provisioning_state: str @@ -6561,7 +5816,7 @@ class SoftwareUpdateConfiguration(_serialization.Model): # pylint: disable=too- "id": {"key": "id", "type": "str"}, "type": {"key": "type", "type": "str"}, "update_configuration": {"key": "properties.updateConfiguration", "type": "UpdateConfiguration"}, - "schedule_info": {"key": "properties.scheduleInfo", "type": "SUCScheduleProperties"}, + "schedule_info": {"key": "properties.scheduleInfo", "type": "ScheduleProperties"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "error": {"key": "properties.error", "type": "ErrorResponse"}, "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, @@ -6575,7 +5830,7 @@ def __init__( self, *, update_configuration: "_models.UpdateConfiguration", - schedule_info: "_models.SUCScheduleProperties", + schedule_info: "_models.ScheduleProperties", error: Optional["_models.ErrorResponse"] = None, tasks: Optional["_models.SoftwareUpdateConfigurationTasks"] = None, **kwargs: Any @@ -6585,24 +5840,24 @@ def __init__( configuration. Required. :paramtype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration :keyword schedule_info: Schedule information for the Software update configuration. Required. - :paramtype schedule_info: ~azure.mgmt.automation.models.SUCScheduleProperties + :paramtype schedule_info: ~azure.mgmt.automation.models.ScheduleProperties :keyword error: Details of provisioning error. :paramtype error: ~azure.mgmt.automation.models.ErrorResponse :keyword tasks: Tasks information for the Software update configuration. :paramtype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks """ super().__init__(**kwargs) - self.name = None - self.id = None - self.type = None + self.name: Optional[str] = None + self.id: Optional[str] = None + self.type: Optional[str] = None self.update_configuration = update_configuration self.schedule_info = schedule_info - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.error = error - self.creation_time = None - self.created_by = None - self.last_modified_time = None - self.last_modified_by = None + self.creation_time: Optional[datetime.datetime] = None + self.created_by: Optional[str] = None + self.last_modified_time: Optional[datetime.datetime] = None + self.last_modified_by: Optional[str] = None self.tasks = tasks @@ -6616,9 +5871,7 @@ class SoftwareUpdateConfigurationCollectionItem(_serialization.Model): # pylint :ivar id: Resource Id of the software update configuration. :vartype id: str :ivar update_configuration: Update specific properties of the software update configuration. - :vartype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration - :ivar tasks: Pre and Post Tasks defined. - :vartype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks + :vartype update_configuration: ~azure.mgmt.automation.models.CollectionItemUpdateConfiguration :ivar frequency: execution frequency of the schedule associated with the software update configuration. Known values are: "OneTime", "Day", "Hour", "Week", "Month", and "Minute". :vartype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency @@ -6648,8 +5901,7 @@ class SoftwareUpdateConfigurationCollectionItem(_serialization.Model): # pylint _attribute_map = { "name": {"key": "name", "type": "str"}, "id": {"key": "id", "type": "str"}, - "update_configuration": {"key": "properties.updateConfiguration", "type": "UpdateConfiguration"}, - "tasks": {"key": "properties.tasks", "type": "SoftwareUpdateConfigurationTasks"}, + "update_configuration": {"key": "properties.updateConfiguration", "type": "CollectionItemUpdateConfiguration"}, "frequency": {"key": "properties.frequency", "type": "str"}, "start_time": {"key": "properties.startTime", "type": "iso-8601"}, "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, @@ -6661,8 +5913,7 @@ class SoftwareUpdateConfigurationCollectionItem(_serialization.Model): # pylint def __init__( self, *, - update_configuration: Optional["_models.UpdateConfiguration"] = None, - tasks: Optional["_models.SoftwareUpdateConfigurationTasks"] = None, + update_configuration: Optional["_models.CollectionItemUpdateConfiguration"] = None, frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = None, start_time: Optional[datetime.datetime] = None, next_run: Optional[datetime.datetime] = None, @@ -6670,9 +5921,8 @@ def __init__( ) -> None: """ :keyword update_configuration: Update specific properties of the software update configuration. - :paramtype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration - :keyword tasks: Pre and Post Tasks defined. - :paramtype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks + :paramtype update_configuration: + ~azure.mgmt.automation.models.CollectionItemUpdateConfiguration :keyword frequency: execution frequency of the schedule associated with the software update configuration. Known values are: "OneTime", "Day", "Hour", "Week", "Month", and "Minute". :paramtype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency @@ -6682,15 +5932,14 @@ def __init__( :paramtype next_run: ~datetime.datetime """ super().__init__(**kwargs) - self.name = None - self.id = None + self.name: Optional[str] = None + self.id: Optional[str] = None self.update_configuration = update_configuration - self.tasks = tasks self.frequency = frequency self.start_time = start_time - self.creation_time = None - self.last_modified_time = None - self.provisioning_state = None + self.creation_time: Optional[datetime.datetime] = None + self.last_modified_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None self.next_run = next_run @@ -6706,7 +5955,7 @@ class SoftwareUpdateConfigurationListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.SoftwareUpdateConfigurationCollectionItem"]] = None, **kwargs: Any + self, *, value: Optional[list["_models.SoftwareUpdateConfigurationCollectionItem"]] = None, **kwargs: Any ) -> None: """ :keyword value: outer object returned when listing all software update configurations. @@ -6716,7 +5965,7 @@ def __init__( self.value = value -class SoftwareUpdateConfigurationMachineRun(_serialization.Model): # pylint: disable=too-many-instance-attributes +class SoftwareUpdateConfigurationMachineRun(_serialization.Model): """Software update configuration machine run model. Variables are only populated by the server, and will be ignored when sending a request. @@ -6820,23 +6069,23 @@ def __init__( :paramtype error: ~azure.mgmt.automation.models.ErrorResponse """ super().__init__(**kwargs) - self.name = None - self.id = None - self.target_computer = None - self.target_computer_type = None + self.name: Optional[str] = None + self.id: Optional[str] = None + self.target_computer: Optional[str] = None + self.target_computer_type: Optional[str] = None self.software_update_configuration = software_update_configuration - self.status = None - self.os_type = None - self.correlation_id = None - self.source_computer_id = None - self.start_time = None - self.end_time = None - self.configured_duration = None + self.status: Optional[str] = None + self.os_type: Optional[str] = None + self.correlation_id: Optional[str] = None + self.source_computer_id: Optional[str] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None + self.configured_duration: Optional[str] = None self.job = job - self.creation_time = None - self.created_by = None - self.last_modified_time = None - self.last_modified_by = None + self.creation_time: Optional[datetime.datetime] = None + self.created_by: Optional[str] = None + self.last_modified_time: Optional[datetime.datetime] = None + self.last_modified_by: Optional[str] = None self.error = error @@ -6857,7 +6106,7 @@ class SoftwareUpdateConfigurationMachineRunListResult(_serialization.Model): # def __init__( self, *, - value: Optional[List["_models.SoftwareUpdateConfigurationMachineRun"]] = None, + value: Optional[list["_models.SoftwareUpdateConfigurationMachineRun"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: @@ -6873,7 +6122,7 @@ def __init__( self.next_link = next_link -class SoftwareUpdateConfigurationRun(_serialization.Model): # pylint: disable=too-many-instance-attributes +class SoftwareUpdateConfigurationRun(_serialization.Model): """Software update configuration Run properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -6908,7 +6157,7 @@ class SoftwareUpdateConfigurationRun(_serialization.Model): # pylint: disable=t :ivar last_modified_by: LastModifiedBy property, which only appears in the response. :vartype last_modified_by: str :ivar tasks: Software update configuration tasks triggered in this run. - :vartype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTasks + :vartype tasks: ~azure.mgmt.automation.models.SoftareUpdateConfigurationRunTasks """ _validation = { @@ -6945,14 +6194,14 @@ class SoftwareUpdateConfigurationRun(_serialization.Model): # pylint: disable=t "created_by": {"key": "properties.createdBy", "type": "str"}, "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, "last_modified_by": {"key": "properties.lastModifiedBy", "type": "str"}, - "tasks": {"key": "properties.tasks", "type": "SoftwareUpdateConfigurationRunTasks"}, + "tasks": {"key": "properties.tasks", "type": "SoftareUpdateConfigurationRunTasks"}, } def __init__( self, *, software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = None, - tasks: Optional["_models.SoftwareUpdateConfigurationRunTasks"] = None, + tasks: Optional["_models.SoftareUpdateConfigurationRunTasks"] = None, **kwargs: Any ) -> None: """ @@ -6960,23 +6209,23 @@ def __init__( :paramtype software_update_configuration: ~azure.mgmt.automation.models.UpdateConfigurationNavigation :keyword tasks: Software update configuration tasks triggered in this run. - :paramtype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTasks + :paramtype tasks: ~azure.mgmt.automation.models.SoftareUpdateConfigurationRunTasks """ super().__init__(**kwargs) - self.name = None - self.id = None + self.name: Optional[str] = None + self.id: Optional[str] = None self.software_update_configuration = software_update_configuration - self.status = None - self.configured_duration = None - self.os_type = None - self.start_time = None - self.end_time = None - self.computer_count = None - self.failed_count = None - self.creation_time = None - self.created_by = None - self.last_modified_time = None - self.last_modified_by = None + self.status: Optional[str] = None + self.configured_duration: Optional[str] = None + self.os_type: Optional[str] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None + self.computer_count: Optional[int] = None + self.failed_count: Optional[int] = None + self.creation_time: Optional[datetime.datetime] = None + self.created_by: Optional[str] = None + self.last_modified_time: Optional[datetime.datetime] = None + self.last_modified_by: Optional[str] = None self.tasks = tasks @@ -6997,7 +6246,7 @@ class SoftwareUpdateConfigurationRunListResult(_serialization.Model): def __init__( self, *, - value: Optional[List["_models.SoftwareUpdateConfigurationRun"]] = None, + value: Optional[list["_models.SoftwareUpdateConfigurationRun"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: @@ -7012,73 +6261,6 @@ def __init__( self.next_link = next_link -class SoftwareUpdateConfigurationRunTaskProperties(_serialization.Model): # pylint: disable=name-too-long - """Task properties of the software update configuration. - - :ivar status: The status of the task. - :vartype status: str - :ivar source: The name of the source of the task. - :vartype source: str - :ivar job_id: The job id of the task. - :vartype job_id: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "source": {"key": "source", "type": "str"}, - "job_id": {"key": "jobId", "type": "str"}, - } - - def __init__( - 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 - :keyword source: The name of the source of the task. - :paramtype source: str - :keyword job_id: The job id of the task. - :paramtype job_id: str - """ - super().__init__(**kwargs) - self.status = status - self.source = source - self.job_id = job_id - - -class SoftwareUpdateConfigurationRunTasks(_serialization.Model): - """Software update configuration run tasks model. - - :ivar pre_task: Pre task properties. - :vartype pre_task: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties - :ivar post_task: Post task properties. - :vartype post_task: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties - """ - - _attribute_map = { - "pre_task": {"key": "preTask", "type": "SoftwareUpdateConfigurationRunTaskProperties"}, - "post_task": {"key": "postTask", "type": "SoftwareUpdateConfigurationRunTaskProperties"}, - } - - def __init__( - self, - *, - pre_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = None, - post_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword pre_task: Pre task properties. - :paramtype pre_task: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties - :keyword post_task: Post task properties. - :paramtype post_task: - ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties - """ - super().__init__(**kwargs) - self.pre_task = pre_task - self.post_task = post_task - - class SoftwareUpdateConfigurationTasks(_serialization.Model): """Task properties of the software update configuration. @@ -7111,7 +6293,7 @@ def __init__( self.post_task = post_task -class SourceControl(ProxyResource): # pylint: disable=too-many-instance-attributes +class SourceControl(ProxyResource): """Definition of the source control. Variables are only populated by the server, and will be ignored when sending a request. @@ -7313,7 +6495,7 @@ class SourceControlListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.SourceControl"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.SourceControl"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: The list of source controls. @@ -7437,14 +6619,14 @@ def __init__( :paramtype sync_type: str or ~azure.mgmt.automation.models.SyncType """ super().__init__(**kwargs) - self.name = None - self.type = None - self.id = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.id: Optional[str] = None self.source_control_sync_job_id = source_control_sync_job_id - self.creation_time = None + self.creation_time: Optional[datetime.datetime] = None self.provisioning_state = provisioning_state - self.start_time = None - self.end_time = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None self.sync_type = sync_type @@ -7515,10 +6697,10 @@ def __init__( super().__init__(**kwargs) self.id = id self.source_control_sync_job_id = source_control_sync_job_id - self.creation_time = None + self.creation_time: Optional[datetime.datetime] = None self.provisioning_state = provisioning_state - self.start_time = None - self.end_time = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None self.sync_type = sync_type self.exception = exception @@ -7568,7 +6750,7 @@ class SourceControlSyncJobListResult(_serialization.Model): def __init__( self, *, - value: Optional[List["_models.SourceControlSyncJob"]] = None, + value: Optional[list["_models.SourceControlSyncJob"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: @@ -7630,10 +6812,10 @@ def __init__( :paramtype stream_type: str or ~azure.mgmt.automation.models.StreamType """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.source_control_sync_job_stream_id = source_control_sync_job_stream_id self.summary = summary - self.time = None + self.time: Optional[datetime.datetime] = None self.stream_type = stream_type @@ -7680,7 +6862,7 @@ def __init__( summary: Optional[str] = None, stream_type: Optional[Union[str, "_models.StreamType"]] = None, stream_text: Optional[str] = None, - value: Optional[Dict[str, JSON]] = None, + value: Optional[dict[str, JSON]] = None, **kwargs: Any ) -> None: """ @@ -7696,10 +6878,10 @@ def __init__( :paramtype value: dict[str, JSON] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.source_control_sync_job_stream_id = source_control_sync_job_stream_id self.summary = summary - self.time = None + self.time: Optional[datetime.datetime] = None self.stream_type = stream_type self.stream_text = stream_text self.value = value @@ -7725,14 +6907,14 @@ class SourceControlSyncJobStreamsListBySyncJob(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SourceControlSyncJobStream"]] = None, **kwargs: Any) -> None: + 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] """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class SourceControlUpdateParameters(_serialization.Model): @@ -7831,11 +7013,11 @@ class Statistics(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.counter_property = None - self.counter_value = None - self.start_time = None - self.end_time = None - self.id = None + self.counter_property: Optional[str] = None + self.counter_value: Optional[int] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None + self.id: Optional[str] = None class StatisticsListResult(_serialization.Model): @@ -7849,7 +7031,7 @@ class StatisticsListResult(_serialization.Model): "value": {"key": "value", "type": "[Statistics]"}, } - def __init__(self, *, value: Optional[List["_models.Statistics"]] = None, **kwargs: Any) -> None: + 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] @@ -7858,191 +7040,6 @@ def __init__(self, *, value: Optional[List["_models.Statistics"]] = None, **kwar self.value = value -class SUCScheduleProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Definition of schedule parameters. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar start_time: Gets or sets the start time of the schedule. - :vartype start_time: ~datetime.datetime - :ivar start_time_offset_minutes: Gets the start time's offset in minutes. - :vartype start_time_offset_minutes: float - :ivar expiry_time: Gets or sets the end time of the schedule. - :vartype expiry_time: ~datetime.datetime - :ivar expiry_time_offset_minutes: Gets or sets the expiry time's offset in minutes. - :vartype expiry_time_offset_minutes: float - :ivar is_enabled: Gets or sets a value indicating whether this schedule is enabled. - :vartype is_enabled: bool - :ivar next_run: Gets or sets the next run time of the schedule. - :vartype next_run: ~datetime.datetime - :ivar next_run_offset_minutes: Gets or sets the next run time's offset in minutes. - :vartype next_run_offset_minutes: float - :ivar interval: Gets or sets the interval of the schedule. - :vartype interval: int - :ivar frequency: Gets or sets the frequency of the schedule. Known values are: "OneTime", - "Day", "Hour", "Week", "Month", and "Minute". - :vartype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency - :ivar time_zone: Gets or sets the time zone of the schedule. - :vartype time_zone: str - :ivar advanced_schedule: Gets or sets the advanced schedule. - :vartype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule - :ivar creation_time: Gets or sets the creation time. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Gets or sets the last modified time. - :vartype last_modified_time: ~datetime.datetime - :ivar description: Gets or sets the description. - :vartype description: str - """ - - _validation = { - "start_time_offset_minutes": {"readonly": True}, - } - - _attribute_map = { - "start_time": {"key": "startTime", "type": "iso-8601"}, - "start_time_offset_minutes": {"key": "startTimeOffsetMinutes", "type": "float"}, - "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, - "expiry_time_offset_minutes": {"key": "expiryTimeOffsetMinutes", "type": "float"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "next_run": {"key": "nextRun", "type": "iso-8601"}, - "next_run_offset_minutes": {"key": "nextRunOffsetMinutes", "type": "float"}, - "interval": {"key": "interval", "type": "int"}, - "frequency": {"key": "frequency", "type": "str"}, - "time_zone": {"key": "timeZone", "type": "str"}, - "advanced_schedule": {"key": "advancedSchedule", "type": "AdvancedSchedule"}, - "creation_time": {"key": "creationTime", "type": "iso-8601"}, - "last_modified_time": {"key": "lastModifiedTime", "type": "iso-8601"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - start_time: Optional[datetime.datetime] = None, - expiry_time: Optional[datetime.datetime] = None, - expiry_time_offset_minutes: Optional[float] = None, - is_enabled: bool = False, - next_run: Optional[datetime.datetime] = None, - next_run_offset_minutes: Optional[float] = None, - interval: Optional[int] = None, - frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = None, - time_zone: Optional[str] = None, - advanced_schedule: Optional["_models.AdvancedSchedule"] = None, - creation_time: Optional[datetime.datetime] = None, - last_modified_time: Optional[datetime.datetime] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword start_time: Gets or sets the start time of the schedule. - :paramtype start_time: ~datetime.datetime - :keyword expiry_time: Gets or sets the end time of the schedule. - :paramtype expiry_time: ~datetime.datetime - :keyword expiry_time_offset_minutes: Gets or sets the expiry time's offset in minutes. - :paramtype expiry_time_offset_minutes: float - :keyword is_enabled: Gets or sets a value indicating whether this schedule is enabled. - :paramtype is_enabled: bool - :keyword next_run: Gets or sets the next run time of the schedule. - :paramtype next_run: ~datetime.datetime - :keyword next_run_offset_minutes: Gets or sets the next run time's offset in minutes. - :paramtype next_run_offset_minutes: float - :keyword interval: Gets or sets the interval of the schedule. - :paramtype interval: int - :keyword frequency: Gets or sets the frequency of the schedule. Known values are: "OneTime", - "Day", "Hour", "Week", "Month", and "Minute". - :paramtype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency - :keyword time_zone: Gets or sets the time zone of the schedule. - :paramtype time_zone: str - :keyword advanced_schedule: Gets or sets the advanced schedule. - :paramtype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule - :keyword creation_time: Gets or sets the creation time. - :paramtype creation_time: ~datetime.datetime - :keyword last_modified_time: Gets or sets the last modified time. - :paramtype last_modified_time: ~datetime.datetime - :keyword description: Gets or sets the description. - :paramtype description: str - """ - super().__init__(**kwargs) - self.start_time = start_time - self.start_time_offset_minutes = None - self.expiry_time = expiry_time - self.expiry_time_offset_minutes = expiry_time_offset_minutes - self.is_enabled = is_enabled - self.next_run = next_run - self.next_run_offset_minutes = next_run_offset_minutes - self.interval = interval - self.frequency = frequency - self.time_zone = time_zone - self.advanced_schedule = advanced_schedule - self.creation_time = creation_time - self.last_modified_time = last_modified_time - self.description = description - - -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.automation.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.automation.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.automation.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.automation.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 TagSettingsProperties(_serialization.Model): """Tag filter information for the VM. @@ -8061,7 +7058,7 @@ class TagSettingsProperties(_serialization.Model): def __init__( self, *, - tags: Optional[Dict[str, List[str]]] = None, + tags: Optional[dict[str, list[str]]] = None, filter_operator: Optional[Union[str, "_models.TagOperators"]] = None, **kwargs: Any ) -> None: @@ -8094,8 +7091,8 @@ class TargetProperties(_serialization.Model): def __init__( self, *, - azure_queries: Optional[List["_models.AzureQueryProperties"]] = None, - non_azure_queries: Optional[List["_models.NonAzureQueryProperties"]] = None, + azure_queries: Optional[list["_models.AzureQueryProperties"]] = None, + non_azure_queries: Optional[list["_models.NonAzureQueryProperties"]] = None, **kwargs: Any ) -> None: """ @@ -8124,7 +7121,7 @@ class TaskProperties(_serialization.Model): } def __init__( - self, *, parameters: Optional[Dict[str, str]] = None, source: Optional[str] = None, **kwargs: Any + self, *, parameters: Optional[dict[str, str]] = None, source: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword parameters: Gets or sets the parameters of the task. @@ -8137,7 +7134,7 @@ def __init__( self.source = source -class TestJob(_serialization.Model): # pylint: disable=too-many-instance-attributes +class TestJob(_serialization.Model): """Definition of the test job. :ivar creation_time: Gets or sets the creation time of the test job. @@ -8191,7 +7188,7 @@ def __init__( exception: Optional[str] = None, last_modified_time: Optional[datetime.datetime] = None, last_status_modified_time: Optional[datetime.datetime] = None, - parameters: Optional[Dict[str, str]] = None, + parameters: Optional[dict[str, str]] = None, log_activity_trace: Optional[int] = None, **kwargs: Any ) -> None: @@ -8250,7 +7247,7 @@ class TestJobCreateParameters(_serialization.Model): } def __init__( - self, *, parameters: Optional[Dict[str, str]] = None, run_on: Optional[str] = None, **kwargs: Any + 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. @@ -8301,7 +7298,7 @@ class TypeFieldListResult(_serialization.Model): "value": {"key": "value", "type": "[TypeField]"}, } - def __init__(self, *, value: Optional[List["_models.TypeField"]] = None, **kwargs: Any) -> None: + 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] @@ -8356,8 +7353,8 @@ def __init__( windows: Optional["_models.WindowsProperties"] = None, linux: Optional["_models.LinuxProperties"] = None, duration: Optional[datetime.timedelta] = None, - azure_virtual_machines: Optional[List[str]] = None, - non_azure_computer_names: Optional[List[str]] = None, + azure_virtual_machines: Optional[list[str]] = None, + non_azure_computer_names: Optional[list[str]] = None, targets: Optional["_models.TargetProperties"] = None, **kwargs: Any ) -> None: @@ -8412,7 +7409,7 @@ class UpdateConfigurationNavigation(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None + self.name: Optional[str] = None class Usage(_serialization.Model): @@ -8512,7 +7509,7 @@ class UsageListResult(_serialization.Model): "value": {"key": "value", "type": "[Usage]"}, } - def __init__(self, *, value: Optional[List["_models.Usage"]] = None, **kwargs: Any) -> None: + 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] @@ -8521,34 +7518,6 @@ def __init__(self, *, value: Optional[List["_models.Usage"]] = None, **kwargs: A self.value = value -class UserAssignedIdentitiesProperties(_serialization.Model): - """UserAssignedIdentitiesProperties. - - 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 Variable(ProxyResource): """Definition of the variable. @@ -8686,7 +7655,7 @@ class VariableListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Variable"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Variable"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: Gets or sets a list of variables. @@ -8738,7 +7707,7 @@ def __init__( self.description = description -class Watcher(Resource): # pylint: disable=too-many-instance-attributes +class Watcher(TrackedResource): """Definition of the watcher type. Variables are only populated by the server, and will be ignored when sending a request. @@ -8749,12 +7718,12 @@ class Watcher(Resource): # pylint: disable=too-many-instance-attributes :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar etag: Gets or sets the etag of the resource. - :vartype etag: str :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. + :ivar location: The Azure Region where the resource lives. :vartype location: str + :ivar etag: Gets or sets the etag of the resource. + :vartype etag: str :ivar execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is invoked. :vartype execution_frequency_in_seconds: int @@ -8791,9 +7760,9 @@ class Watcher(Resource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, "execution_frequency_in_seconds": {"key": "properties.executionFrequencyInSeconds", "type": "int"}, "script_name": {"key": "properties.scriptName", "type": "str"}, "script_parameters": {"key": "properties.scriptParameters", "type": "{str}"}, @@ -8808,23 +7777,23 @@ class Watcher(Resource): # pylint: disable=too-many-instance-attributes def __init__( self, *, - etag: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, location: Optional[str] = None, + etag: Optional[str] = None, execution_frequency_in_seconds: Optional[int] = None, script_name: Optional[str] = None, - script_parameters: Optional[Dict[str, str]] = None, + script_parameters: Optional[dict[str, str]] = None, script_run_on: Optional[str] = None, description: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword etag: Gets or sets the etag of the resource. - :paramtype etag: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. + :keyword location: The Azure Region where the resource lives. :paramtype location: str + :keyword etag: Gets or sets the etag of the resource. + :paramtype etag: str :keyword execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is invoked. :paramtype execution_frequency_in_seconds: int @@ -8839,18 +7808,16 @@ def __init__( :keyword description: Gets or sets the description. :paramtype description: str """ - super().__init__(**kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.etag = etag - self.tags = tags - self.location = location self.execution_frequency_in_seconds = execution_frequency_in_seconds self.script_name = script_name self.script_parameters = script_parameters self.script_run_on = script_run_on - self.status = None - self.creation_time = None - self.last_modified_time = None - self.last_modified_by = None + self.status: Optional[str] = None + self.creation_time: Optional[datetime.datetime] = None + self.last_modified_time: Optional[datetime.datetime] = None + self.last_modified_by: Optional[str] = None self.description = description @@ -8869,7 +7836,7 @@ class WatcherListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Watcher"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Watcher"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: Gets or sets a list of watchers. @@ -8912,7 +7879,7 @@ def __init__( self.execution_frequency_in_seconds = execution_frequency_in_seconds -class Webhook(ProxyResource): # pylint: disable=too-many-instance-attributes +class Webhook(ProxyResource): """Definition of the webhook type. Variables are only populated by the server, and will be ignored when sending a request. @@ -8978,7 +7945,7 @@ def __init__( uri: Optional[str] = None, expiry_time: Optional[datetime.datetime] = None, last_invoked_time: Optional[datetime.datetime] = None, - parameters: Optional[Dict[str, str]] = None, + parameters: Optional[dict[str, str]] = None, runbook: Optional["_models.RunbookAssociationProperty"] = None, run_on: Optional[str] = None, creation_time: Optional[datetime.datetime] = None, @@ -9068,7 +8035,7 @@ def __init__( is_enabled: Optional[bool] = None, uri: Optional[str] = None, expiry_time: Optional[datetime.datetime] = None, - parameters: Optional[Dict[str, str]] = None, + parameters: Optional[dict[str, str]] = None, runbook: Optional["_models.RunbookAssociationProperty"] = None, run_on: Optional[str] = None, **kwargs: Any @@ -9114,7 +8081,7 @@ class WebhookListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Webhook"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Webhook"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: Gets or sets a list of webhooks. @@ -9156,7 +8123,7 @@ def __init__( name: Optional[str] = None, is_enabled: Optional[bool] = None, run_on: Optional[str] = None, - parameters: Optional[Dict[str, str]] = None, + parameters: Optional[dict[str, str]] = None, description: Optional[str] = None, **kwargs: Any ) -> None: @@ -9208,8 +8175,8 @@ def __init__( self, *, included_update_classifications: Optional[Union[str, "_models.WindowsUpdateClasses"]] = None, - excluded_kb_numbers: Optional[List[str]] = None, - included_kb_numbers: Optional[List[str]] = None, + excluded_kb_numbers: Optional[list[str]] = None, + included_kb_numbers: Optional[list[str]] = None, reboot_setting: Optional[str] = None, **kwargs: Any ) -> None: diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_patch.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_patch.py index f7dd32510333..49900f6ab120 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_patch.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_patch.py @@ -2,6 +2,7 @@ # 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 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..e63de9f02ba2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,73 +6,62 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._agent_registration_information_operations import AgentRegistrationInformationOperations -from ._dsc_node_operations import DscNodeOperations -from ._node_reports_operations import NodeReportsOperations -from ._dsc_compilation_job_operations import DscCompilationJobOperations -from ._dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations -from ._node_count_information_operations import NodeCountInformationOperations -from ._watcher_operations import WatcherOperations -from ._software_update_configurations_operations import SoftwareUpdateConfigurationsOperations -from ._webhook_operations import WebhookOperations -from ._deleted_automation_accounts_operations import DeletedAutomationAccountsOperations -from ._automation_account_operations import AutomationAccountOperations -from ._statistics_operations import StatisticsOperations -from ._usages_operations import UsagesOperations -from ._keys_operations import KeysOperations -from ._certificate_operations import CertificateOperations -from ._connection_operations import ConnectionOperations -from ._connection_type_operations import ConnectionTypeOperations -from ._credential_operations import CredentialOperations -from ._dsc_configuration_operations import DscConfigurationOperations -from ._dsc_node_configuration_operations import DscNodeConfigurationOperations -from ._hybrid_runbook_workers_operations import HybridRunbookWorkersOperations -from ._hybrid_runbook_worker_group_operations import HybridRunbookWorkerGroupOperations -from ._job_operations import JobOperations -from ._job_stream_operations import JobStreamOperations -from ._job_schedule_operations import JobScheduleOperations -from ._linked_workspace_operations import LinkedWorkspaceOperations -from ._activity_operations import ActivityOperations -from ._module_operations import ModuleOperations -from ._object_data_types_operations import ObjectDataTypesOperations -from ._fields_operations import FieldsOperations -from ._operations import Operations -from ._automation_client_operations import AutomationClientOperationsMixin -from ._python2_package_operations import Python2PackageOperations -from ._python3_package_operations import Python3PackageOperations -from ._runbook_draft_operations import RunbookDraftOperations -from ._runbook_operations import RunbookOperations -from ._test_job_streams_operations import TestJobStreamsOperations -from ._test_job_operations import TestJobOperations -from ._schedule_operations import ScheduleOperations -from ._software_update_configuration_machine_runs_operations import SoftwareUpdateConfigurationMachineRunsOperations -from ._software_update_configuration_runs_operations import SoftwareUpdateConfigurationRunsOperations -from ._source_control_operations import SourceControlOperations -from ._source_control_sync_job_operations import SourceControlSyncJobOperations -from ._source_control_sync_job_streams_operations import SourceControlSyncJobStreamsOperations -from ._variable_operations import VariableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._automation_account_operations import AutomationAccountOperations # type: ignore +from ._operations import Operations # type: ignore +from ._statistics_operations import StatisticsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._keys_operations import KeysOperations # type: ignore +from ._certificate_operations import CertificateOperations # type: ignore +from ._connection_operations import ConnectionOperations # type: ignore +from ._connection_type_operations import ConnectionTypeOperations # type: ignore +from ._credential_operations import CredentialOperations # type: ignore +from ._dsc_configuration_operations import DscConfigurationOperations # type: ignore +from ._hybrid_runbook_worker_group_operations import HybridRunbookWorkerGroupOperations # type: ignore +from ._job_schedule_operations import JobScheduleOperations # type: ignore +from ._linked_workspace_operations import LinkedWorkspaceOperations # type: ignore +from ._activity_operations import ActivityOperations # type: ignore +from ._module_operations import ModuleOperations # type: ignore +from ._object_data_types_operations import ObjectDataTypesOperations # type: ignore +from ._fields_operations import FieldsOperations # type: ignore +from ._schedule_operations import ScheduleOperations # type: ignore +from ._variable_operations import VariableOperations # type: ignore +from ._webhook_operations import WebhookOperations # type: ignore +from ._watcher_operations import WatcherOperations # type: ignore +from ._software_update_configurations_operations import SoftwareUpdateConfigurationsOperations # type: ignore +from ._software_update_configuration_runs_operations import SoftwareUpdateConfigurationRunsOperations # type: ignore +from ._software_update_configuration_machine_runs_operations import SoftwareUpdateConfigurationMachineRunsOperations # type: ignore +from ._source_control_operations import SourceControlOperations # type: ignore +from ._source_control_sync_job_operations import SourceControlSyncJobOperations # type: ignore +from ._source_control_sync_job_streams_operations import SourceControlSyncJobStreamsOperations # type: ignore +from ._job_operations import JobOperations # type: ignore +from ._job_stream_operations import JobStreamOperations # type: ignore +from ._agent_registration_information_operations import AgentRegistrationInformationOperations # type: ignore +from ._dsc_node_operations import DscNodeOperations # type: ignore +from ._node_reports_operations import NodeReportsOperations # type: ignore +from ._dsc_compilation_job_operations import DscCompilationJobOperations # type: ignore +from ._dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations # type: ignore +from ._dsc_node_configuration_operations import DscNodeConfigurationOperations # type: ignore +from ._node_count_information_operations import NodeCountInformationOperations # type: ignore +from ._runbook_draft_operations import RunbookDraftOperations # type: ignore +from ._runbook_operations import RunbookOperations # type: ignore +from ._test_job_streams_operations import TestJobStreamsOperations # type: ignore +from ._test_job_operations import TestJobOperations # type: ignore +from ._python2_package_operations import Python2PackageOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "PrivateEndpointConnectionsOperations", - "PrivateLinkResourcesOperations", - "AgentRegistrationInformationOperations", - "DscNodeOperations", - "NodeReportsOperations", - "DscCompilationJobOperations", - "DscCompilationJobStreamOperations", - "NodeCountInformationOperations", - "WatcherOperations", - "SoftwareUpdateConfigurationsOperations", - "WebhookOperations", - "DeletedAutomationAccountsOperations", "AutomationAccountOperations", + "Operations", "StatisticsOperations", "UsagesOperations", "KeysOperations", @@ -80,32 +70,37 @@ "ConnectionTypeOperations", "CredentialOperations", "DscConfigurationOperations", - "DscNodeConfigurationOperations", - "HybridRunbookWorkersOperations", "HybridRunbookWorkerGroupOperations", - "JobOperations", - "JobStreamOperations", "JobScheduleOperations", "LinkedWorkspaceOperations", "ActivityOperations", "ModuleOperations", "ObjectDataTypesOperations", "FieldsOperations", - "Operations", - "AutomationClientOperationsMixin", - "Python2PackageOperations", - "Python3PackageOperations", - "RunbookDraftOperations", - "RunbookOperations", - "TestJobStreamsOperations", - "TestJobOperations", "ScheduleOperations", - "SoftwareUpdateConfigurationMachineRunsOperations", + "VariableOperations", + "WebhookOperations", + "WatcherOperations", + "SoftwareUpdateConfigurationsOperations", "SoftwareUpdateConfigurationRunsOperations", + "SoftwareUpdateConfigurationMachineRunsOperations", "SourceControlOperations", "SourceControlSyncJobOperations", "SourceControlSyncJobStreamsOperations", - "VariableOperations", + "JobOperations", + "JobStreamOperations", + "AgentRegistrationInformationOperations", + "DscNodeOperations", + "NodeReportsOperations", + "DscCompilationJobOperations", + "DscCompilationJobStreamOperations", + "DscNodeConfigurationOperations", + "NodeCountInformationOperations", + "RunbookDraftOperations", + "RunbookOperations", + "TestJobStreamsOperations", + "TestJobOperations", + "Python2PackageOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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 50bb28659528..a6a6cbcb15bc 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,14 +26,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -49,14 +48,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities/{activityName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -84,14 +83,14 @@ def build_list_by_module_request( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -124,12 +123,12 @@ class ActivityOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( @@ -157,7 +156,7 @@ def get( :rtype: ~azure.mgmt.automation.models.Activity :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +167,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Activity] = kwargs.pop("cls", None) _request = build_get_request( @@ -192,7 +191,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Activity", pipeline_response.http_response) @@ -205,7 +207,7 @@ def get( @distributed_trace def list_by_module( self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any - ) -> Iterable["_models.Activity"]: + ) -> ItemPaged["_models.Activity"]: """Retrieve a list of activities in the module identified by module name. .. seealso:: @@ -224,10 +226,10 @@ def list_by_module( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.ActivityListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -273,7 +275,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 e3bb03b0acb3..64b0e4405cbb 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,14 +26,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -44,14 +43,14 @@ 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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -77,7 +76,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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -85,7 +84,7 @@ def build_regenerate_key_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation/regenerateKey", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -119,12 +118,12 @@ class AgentRegistrationInformationOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> _models.AgentRegistration: @@ -141,7 +140,7 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: :rtype: ~azure.mgmt.automation.models.AgentRegistration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -152,7 +151,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) _request = build_get_request( @@ -174,7 +173,10 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("AgentRegistration", pipeline_response.http_response) @@ -267,7 +269,7 @@ def regenerate_key( :rtype: ~azure.mgmt.automation.models.AgentRegistration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,7 +280,7 @@ def regenerate_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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) @@ -312,7 +314,10 @@ def regenerate_key( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("AgentRegistration", 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 83d5e3ac8b09..63583141360a 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,7 +44,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", "2022-08-08")) + 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") @@ -53,7 +52,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -81,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-08-08")) + 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") @@ -89,7 +88,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -117,14 +116,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -150,14 +149,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -181,14 +180,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -211,7 +210,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -245,12 +244,12 @@ class AutomationAccountOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def update( @@ -334,7 +333,7 @@ def update( :rtype: ~azure.mgmt.automation.models.AutomationAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -345,7 +344,7 @@ def 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-08-08")) + 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.AutomationAccount] = kwargs.pop("cls", None) @@ -379,7 +378,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("AutomationAccount", pipeline_response.http_response) @@ -472,7 +474,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.AutomationAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -483,7 +485,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", "2022-08-08")) + 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.AutomationAccount] = kwargs.pop("cls", None) @@ -517,7 +519,10 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("AutomationAccount", pipeline_response.http_response) @@ -544,7 +549,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -555,7 +560,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", "2022-08-08")) + 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( @@ -577,7 +582,10 @@ def delete( # pylint: disable=inconsistent-return-statements 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -598,7 +606,7 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: :rtype: ~azure.mgmt.automation.models.AutomationAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -609,7 +617,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) _request = build_get_request( @@ -631,7 +639,10 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("AutomationAccount", pipeline_response.http_response) @@ -642,7 +653,7 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: return deserialized # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.AutomationAccount"]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.AutomationAccount"]: """Retrieve a list of accounts within a given resource group. .. seealso:: @@ -657,10 +668,10 @@ 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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.AutomationAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -704,7 +715,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -712,7 +726,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.AutomationAccount"]: + def list(self, **kwargs: Any) -> ItemPaged["_models.AutomationAccount"]: """Lists the Automation Accounts within an Azure subscription. Retrieve a list of accounts within a given subscription. @@ -724,10 +738,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.AutomationAccount"]: _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.AutomationAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -770,7 +784,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 deleted file mode 100644 index adee29c50c2a..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_client_operations.py +++ /dev/null @@ -1,206 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_convert_graph_runbook_content_request( # pylint: disable=name-too-long - 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", "2022-08-08")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/convertGraphRunbookContent", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "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"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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 AutomationClientOperationsMixin(AutomationClientMixinABC): - - @overload - def convert_graph_runbook_content( - self, - resource_group_name: str, - automation_account_name: str, - parameters: _models.GraphicalRunbookContent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GraphicalRunbookContent: - """Post operation to serialize or deserialize GraphRunbookContent. - - :param resource_group_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: Input data describing the graphical runbook. Required. - :type parameters: ~azure.mgmt.automation.models.GraphicalRunbookContent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: GraphicalRunbookContent or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.GraphicalRunbookContent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def convert_graph_runbook_content( - self, - resource_group_name: str, - automation_account_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GraphicalRunbookContent: - """Post operation to serialize or deserialize GraphRunbookContent. - - :param resource_group_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: Input data describing the graphical runbook. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: GraphicalRunbookContent or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.GraphicalRunbookContent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def convert_graph_runbook_content( - self, - resource_group_name: str, - automation_account_name: str, - parameters: Union[_models.GraphicalRunbookContent, IO[bytes]], - **kwargs: Any - ) -> _models.GraphicalRunbookContent: - """Post operation to serialize or deserialize GraphRunbookContent. - - :param resource_group_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: Input data describing the graphical runbook. Is either a - GraphicalRunbookContent type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.GraphicalRunbookContent or IO[bytes] - :return: GraphicalRunbookContent or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.GraphicalRunbookContent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - 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, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "GraphicalRunbookContent") - - _request = build_convert_graph_runbook_content_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GraphicalRunbookContent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore 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 bc2182270c5d..c34b0cd65cd9 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,14 +44,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -79,14 +78,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -113,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", "2022-08-08")) + 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") @@ -121,7 +120,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -150,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", "2022-08-08")) + 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") @@ -158,7 +157,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -187,14 +186,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -226,12 +225,12 @@ class CertificateOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -252,7 +251,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -263,7 +262,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", "2022-08-08")) + 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( @@ -286,7 +285,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -311,7 +313,7 @@ def get( :rtype: ~azure.mgmt.automation.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,7 +324,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) _request = build_get_request( @@ -345,7 +347,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Certificate", pipeline_response.http_response) @@ -452,7 +457,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -463,7 +468,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", "2022-08-08")) + 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.Certificate] = kwargs.pop("cls", None) @@ -498,7 +503,10 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Certificate", pipeline_response.http_response) @@ -599,7 +607,7 @@ def update( :rtype: ~azure.mgmt.automation.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -610,7 +618,7 @@ def 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-08-08")) + 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.Certificate] = kwargs.pop("cls", None) @@ -645,7 +653,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Certificate", pipeline_response.http_response) @@ -658,7 +669,7 @@ def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> Iterable["_models.Certificate"]: + ) -> ItemPaged["_models.Certificate"]: """Retrieve a list of certificates. .. seealso:: @@ -675,10 +686,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.CertificateListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -723,7 +734,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 df8712d1010f..ccd32fe507d2 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,14 +44,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -79,14 +78,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -113,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", "2022-08-08")) + 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") @@ -121,7 +120,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -150,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", "2022-08-08")) + 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") @@ -158,7 +157,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -187,14 +186,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -226,17 +225,17 @@ class ConnectionOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def delete( self, resource_group_name: str, automation_account_name: str, connection_name: str, **kwargs: Any - ) -> None: + ) -> Optional[_models.Connection]: """Delete the connection. .. seealso:: @@ -248,11 +247,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type automation_account_name: str :param connection_name: The name of connection. Required. :type connection_name: str - :return: None or the result of cls(response) - :rtype: None + :return: Connection or None or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Connection or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -263,8 +262,8 @@ 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", "2022-08-08")) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + cls: ClsType[Optional[_models.Connection]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -286,11 +285,20 @@ def delete( # pylint: disable=inconsistent-return-statements 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) + 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("Connection", pipeline_response.http_response) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def get( @@ -311,7 +319,7 @@ def get( :rtype: ~azure.mgmt.automation.models.Connection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,7 +330,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) _request = build_get_request( @@ -345,7 +353,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Connection", pipeline_response.http_response) @@ -451,7 +462,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.Connection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -462,7 +473,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", "2022-08-08")) + 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.Connection] = kwargs.pop("cls", None) @@ -497,7 +508,10 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Connection", pipeline_response.http_response) @@ -598,7 +612,7 @@ def update( :rtype: ~azure.mgmt.automation.models.Connection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -609,7 +623,7 @@ def 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-08-08")) + 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.Connection] = kwargs.pop("cls", None) @@ -644,7 +658,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Connection", pipeline_response.http_response) @@ -657,7 +674,7 @@ def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> Iterable["_models.Connection"]: + ) -> ItemPaged["_models.Connection"]: """Retrieve a list of connections. .. seealso:: @@ -674,10 +691,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.ConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -722,7 +739,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 50ac0f4b715b..4f4911557f67 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -49,14 +48,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -87,14 +86,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -125,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + 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") @@ -133,7 +132,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -162,14 +161,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -201,12 +200,12 @@ class ConnectionTypeOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -227,7 +226,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -238,7 +237,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", "2022-08-08")) + 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( @@ -261,7 +260,10 @@ def delete( # pylint: disable=inconsistent-return-statements 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -286,7 +288,7 @@ def get( :rtype: ~azure.mgmt.automation.models.ConnectionType :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -297,7 +299,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) _request = build_get_request( @@ -320,7 +322,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ConnectionType", pipeline_response.http_response) @@ -427,7 +432,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.ConnectionType :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -438,7 +443,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", "2022-08-08")) + 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.ConnectionType] = kwargs.pop("cls", None) @@ -471,9 +476,12 @@ def create_or_update( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [201, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ConnectionType", pipeline_response.http_response) @@ -486,7 +494,7 @@ def create_or_update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> Iterable["_models.ConnectionType"]: + ) -> ItemPaged["_models.ConnectionType"]: """Retrieve a list of connection types. .. seealso:: @@ -503,10 +511,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.ConnectionTypeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -551,7 +559,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 372bc426007e..4772df2f9f50 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,14 +44,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -79,14 +78,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -113,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", "2022-08-08")) + 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") @@ -121,7 +120,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -150,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", "2022-08-08")) + 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") @@ -158,7 +157,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -187,14 +186,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -226,12 +225,12 @@ class CredentialOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -252,7 +251,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -263,7 +262,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", "2022-08-08")) + 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( @@ -286,7 +285,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -311,7 +313,7 @@ def get( :rtype: ~azure.mgmt.automation.models.Credential :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,7 +324,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) _request = build_get_request( @@ -345,7 +347,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Credential", pipeline_response.http_response) @@ -451,7 +456,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.Credential :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -462,7 +467,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", "2022-08-08")) + 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.Credential] = kwargs.pop("cls", None) @@ -497,7 +502,10 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Credential", pipeline_response.http_response) @@ -598,7 +606,7 @@ def update( :rtype: ~azure.mgmt.automation.models.Credential :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -609,7 +617,7 @@ def 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-08-08")) + 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.Credential] = kwargs.pop("cls", None) @@ -644,7 +652,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Credential", pipeline_response.http_response) @@ -657,7 +668,7 @@ def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> Iterable["_models.Credential"]: + ) -> ItemPaged["_models.Credential"]: """Retrieve a list of credentials. .. seealso:: @@ -674,10 +685,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.CredentialListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 deleted file mode 100644 index 83a91a3d95c6..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_deleted_automation_accounts_operations.py +++ /dev/null @@ -1,132 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_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", "2022-01-31")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Automation/deletedAutomationAccounts" - ) # 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) - - -class DeletedAutomationAccountsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`deleted_automation_accounts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = 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) -> _models.DeletedAutomationAccountListResult: - """Retrieve deleted automation account. - - :return: DeletedAutomationAccountListResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DeletedAutomationAccountListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-31")) - cls: ClsType[_models.DeletedAutomationAccountListResult] = kwargs.pop("cls", None) - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeletedAutomationAccountListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore 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 354ec09bb30a..4c8ba33b31eb 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,14 +31,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -53,7 +52,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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -61,7 +60,7 @@ def build_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -94,14 +93,14 @@ 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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -133,14 +132,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -173,14 +172,14 @@ def build_get_stream_request( _headers = case_insensitive_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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams/{jobStreamId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -214,12 +213,12 @@ class DscCompilationJobOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") def _create_initial( self, @@ -229,7 +228,7 @@ def _create_initial( parameters: Union[_models.DscCompilationJobCreateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -240,7 +239,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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) @@ -280,7 +279,10 @@ def _create_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -387,7 +389,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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) 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) @@ -451,7 +453,7 @@ def get( :rtype: ~azure.mgmt.automation.models.DscCompilationJob :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -462,7 +464,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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) _request = build_get_request( @@ -485,7 +487,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscCompilationJob", pipeline_response.http_response) @@ -498,7 +503,7 @@ def get( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.DscCompilationJob"]: + ) -> ItemPaged["_models.DscCompilationJob"]: """Retrieve a list of dsc compilation jobs. .. seealso:: @@ -517,10 +522,10 @@ def list_by_automation_account( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscCompilationJobListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +571,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -594,7 +602,7 @@ def get_stream( :rtype: ~azure.mgmt.automation.models.JobStream :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -605,7 +613,7 @@ def get_stream( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) _request = build_get_stream_request( @@ -629,7 +637,10 @@ def get_stream( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("JobStream", 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 697d7941fffe..d8e1c213876e 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code 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, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,14 +25,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,14 +42,14 @@ def build_list_by_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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -83,12 +82,12 @@ class DscCompilationJobStreamOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_job( @@ -109,7 +108,7 @@ def list_by_job( :rtype: ~azure.mgmt.automation.models.JobStreamListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -120,7 +119,7 @@ def list_by_job( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) _request = build_list_by_job_request( @@ -143,7 +142,10 @@ def list_by_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("JobStreamListResult", 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 4ba5b0c2322f..c95438335db1 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code 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, Type, TypeVar, Union, overload +from collections.abc import MutableMapping +from typing import Any, Callable, Iterator, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,14 +28,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -46,14 +45,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -80,14 +79,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -114,7 +113,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-08-08")) + 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") @@ -122,7 +121,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -151,7 +150,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", "2022-08-08")) + 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") @@ -159,7 +158,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -188,14 +187,14 @@ def build_get_content_request( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "text/powershell") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}/content", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -230,14 +229,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -277,12 +276,12 @@ class DscConfigurationOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -303,7 +302,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,7 +313,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", "2022-08-08")) + 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( @@ -337,7 +336,10 @@ def delete( # pylint: disable=inconsistent-return-statements 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -362,7 +364,7 @@ def get( :rtype: ~azure.mgmt.automation.models.DscConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,7 +375,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) _request = build_get_request( @@ -396,7 +398,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscConfiguration", pipeline_response.http_response) @@ -497,7 +502,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.DscConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +513,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", "2022-08-08")) + 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.DscConfiguration] = kwargs.pop("cls", None) @@ -543,7 +548,10 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscConfiguration", pipeline_response.http_response) @@ -644,7 +652,7 @@ def update( :rtype: ~azure.mgmt.automation.models.DscConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -655,14 +663,15 @@ def 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-08-08")) + 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)) + content_type = content_type if parameters else None cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) _json = None _content = None if isinstance(parameters, msrest.Model): - content_type = content_type or "application/json" + content_type = content_type or "application/json" if parameters else None if parameters is not None: _json = self._serialize.body(parameters, "DscConfigurationUpdateParameters") else: @@ -696,7 +705,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscConfiguration", pipeline_response.http_response) @@ -725,7 +737,7 @@ def get_content( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -736,7 +748,7 @@ def get_content( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_get_content_request( @@ -783,7 +795,7 @@ def list_by_automation_account( top: Optional[int] = None, inlinecount: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.DscConfiguration"]: + ) -> ItemPaged["_models.DscConfiguration"]: """Retrieve a list of configurations. .. seealso:: @@ -808,10 +820,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.DscConfigurationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -860,7 +872,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 fc27aa85c5cc..cea9b7e4e8bf 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,14 +31,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -53,14 +52,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -91,14 +90,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -129,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -137,7 +136,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -174,14 +173,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -221,12 +220,12 @@ class DscNodeConfigurationOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -247,7 +246,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +257,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -281,7 +280,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -306,7 +308,7 @@ def get( :rtype: ~azure.mgmt.automation.models.DscNodeConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -317,7 +319,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscNodeConfiguration] = kwargs.pop("cls", None) _request = build_get_request( @@ -340,7 +342,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscNodeConfiguration", pipeline_response.http_response) @@ -358,7 +363,7 @@ def _create_or_update_initial( parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -369,7 +374,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) @@ -409,7 +414,10 @@ def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -517,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) 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) @@ -572,7 +580,7 @@ def list_by_automation_account( top: Optional[int] = None, inlinecount: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.DscNodeConfiguration"]: + ) -> ItemPaged["_models.DscNodeConfiguration"]: """Retrieve a list of dsc node configurations. .. seealso:: @@ -598,10 +606,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscNodeConfigurationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -650,7 +658,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 8eb8870812c8..1a15e89e8604 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,14 +44,14 @@ 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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -79,14 +78,14 @@ 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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -113,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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -121,7 +120,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -158,14 +157,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -205,17 +204,17 @@ class DscNodeOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def delete( self, resource_group_name: str, automation_account_name: str, node_id: str, **kwargs: Any - ) -> None: + ) -> _models.DscNode: """Delete the dsc node identified by node id. .. seealso:: @@ -227,11 +226,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type automation_account_name: str :param node_id: The node id. Required. :type node_id: str - :return: None or the result of cls(response) - :rtype: None + :return: DscNode or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.DscNode :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -242,8 +241,8 @@ 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", "2020-01-13-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) + cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -265,11 +264,18 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize("DscNode", pipeline_response.http_response) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def get( @@ -290,7 +296,7 @@ def get( :rtype: ~azure.mgmt.automation.models.DscNode :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -301,7 +307,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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) _request = build_get_request( @@ -324,7 +330,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscNode", pipeline_response.http_response) @@ -426,7 +435,7 @@ def update( :rtype: ~azure.mgmt.automation.models.DscNode :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +446,7 @@ def 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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) @@ -472,7 +481,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscNode", pipeline_response.http_response) @@ -492,7 +504,7 @@ def list_by_automation_account( top: Optional[int] = None, inlinecount: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.DscNode"]: + ) -> ItemPaged["_models.DscNode"]: """Retrieve a list of dsc nodes. .. seealso:: @@ -517,10 +529,10 @@ def list_by_automation_account( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscNodeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -569,7 +581,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 c7c71d1e5b98..3d06567a2e9a 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,14 +26,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -49,14 +48,14 @@ def build_list_by_type_request( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/types/{typeName}/fields", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -90,17 +89,17 @@ class FieldsOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_type( self, resource_group_name: str, automation_account_name: str, module_name: str, type_name: str, **kwargs: Any - ) -> Iterable["_models.TypeField"]: + ) -> ItemPaged["_models.TypeField"]: """Retrieve a list of fields of a given type identified by module name. .. seealso:: @@ -121,10 +120,10 @@ def list_by_type( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +170,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 951dda65a1c9..6824796e6d1b 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -49,14 +48,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -89,14 +88,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -119,49 +118,6 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_request( - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_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", "2022-08-08")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "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"), - "hybridRunbookWorkerGroupName": _SERIALIZER.url( - "hybrid_runbook_worker_group_name", hybrid_runbook_worker_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_update_request( resource_group_name: str, automation_account_name: str, @@ -172,7 +128,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", "2022-08-08")) + 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") @@ -180,7 +136,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -216,14 +172,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -257,12 +213,12 @@ class HybridRunbookWorkerGroupOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -287,7 +243,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -298,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + 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( @@ -321,7 +277,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -350,7 +309,7 @@ def get( :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -361,7 +320,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) _request = build_get_request( @@ -384,163 +343,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("HybridRunbookWorkerGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_group_creation_parameters: _models.HybridRunbookWorkerGroupCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :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. Required. - :type hybrid_runbook_worker_group_creation_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: HybridRunbookWorkerGroup or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_group_creation_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :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. Required. - :type hybrid_runbook_worker_group_creation_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: HybridRunbookWorkerGroup or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_group_creation_parameters: Union[ - _models.HybridRunbookWorkerGroupCreateOrUpdateParameters, IO[bytes] - ], - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :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 HybridRunbookWorkerGroupCreateOrUpdateParameters type - or a IO[bytes] type. Required. - :type hybrid_runbook_worker_group_creation_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or IO[bytes] - :return: HybridRunbookWorkerGroup or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - 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, (IOBase, bytes)): - _content = hybrid_runbook_worker_group_creation_parameters - else: - _json = self._serialize.body( - hybrid_runbook_worker_group_creation_parameters, "HybridRunbookWorkerGroupCreateOrUpdateParameters" + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, ) - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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("HybridRunbookWorkerGroup", pipeline_response.http_response) @@ -556,7 +362,7 @@ def update( resource_group_name: str, automation_account_name: str, hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_group_updation_parameters: _models.HybridRunbookWorkerGroupCreateOrUpdateParameters, + parameters: _models.HybridRunbookWorkerGroupUpdateParameters, *, content_type: str = "application/json", **kwargs: Any @@ -572,10 +378,8 @@ def update( :type automation_account_name: str :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. - Required. - :type hybrid_runbook_worker_group_updation_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters + :param parameters: The hybrid runbook worker group. Required. + :type parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerGroupUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -590,7 +394,7 @@ def update( resource_group_name: str, automation_account_name: str, hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_group_updation_parameters: IO[bytes], + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -606,9 +410,8 @@ def update( :type automation_account_name: str :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. - Required. - :type hybrid_runbook_worker_group_updation_parameters: IO[bytes] + :param parameters: The hybrid runbook worker group. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -623,9 +426,7 @@ def update( resource_group_name: str, automation_account_name: str, hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_group_updation_parameters: Union[ - _models.HybridRunbookWorkerGroupCreateOrUpdateParameters, IO[bytes] - ], + parameters: Union[_models.HybridRunbookWorkerGroupUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. @@ -639,15 +440,15 @@ def update( :type automation_account_name: str :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 HybridRunbookWorkerGroupCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type hybrid_runbook_worker_group_updation_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or IO[bytes] + :param parameters: The hybrid runbook worker group. Is either a + HybridRunbookWorkerGroupUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerGroupUpdateParameters or + IO[bytes] :return: HybridRunbookWorkerGroup or the result of cls(response) :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -658,19 +459,17 @@ def 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-08-08")) + 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.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_group_updation_parameters, (IOBase, bytes)): - _content = hybrid_runbook_worker_group_updation_parameters + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _json = self._serialize.body( - hybrid_runbook_worker_group_updation_parameters, "HybridRunbookWorkerGroupCreateOrUpdateParameters" - ) + _json = self._serialize.body(parameters, "HybridRunbookWorkerGroupUpdateParameters") _request = build_update_request( resource_group_name=resource_group_name, @@ -695,7 +494,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("HybridRunbookWorkerGroup", pipeline_response.http_response) @@ -708,7 +510,7 @@ def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.HybridRunbookWorkerGroup"]: + ) -> ItemPaged["_models.HybridRunbookWorkerGroup"]: """Retrieve a list of hybrid runbook worker groups. .. seealso:: @@ -728,10 +530,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.HybridRunbookWorkerGroupsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -777,7 +579,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 deleted file mode 100644 index 8ca987be9bb0..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_workers_operations.py +++ /dev/null @@ -1,822 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, 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.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_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", "2022-08-08")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "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"), - "hybridRunbookWorkerGroupName": _SERIALIZER.url( - "hybrid_runbook_worker_group_name", hybrid_runbook_worker_group_name, "str" - ), - "hybridRunbookWorkerId": _SERIALIZER.url("hybrid_runbook_worker_id", hybrid_runbook_worker_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # 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, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_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", "2022-08-08")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "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"), - "hybridRunbookWorkerGroupName": _SERIALIZER.url( - "hybrid_runbook_worker_group_name", hybrid_runbook_worker_group_name, "str" - ), - "hybridRunbookWorkerId": _SERIALIZER.url("hybrid_runbook_worker_id", hybrid_runbook_worker_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_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, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_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", "2022-08-08")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "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"), - "hybridRunbookWorkerGroupName": _SERIALIZER.url( - "hybrid_runbook_worker_group_name", hybrid_runbook_worker_group_name, "str" - ), - "hybridRunbookWorkerId": _SERIALIZER.url("hybrid_runbook_worker_id", hybrid_runbook_worker_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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_move_request( - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_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", "2022-08-08")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}/move", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "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"), - "hybridRunbookWorkerGroupName": _SERIALIZER.url( - "hybrid_runbook_worker_group_name", hybrid_runbook_worker_group_name, "str" - ), - "hybridRunbookWorkerId": _SERIALIZER.url("hybrid_runbook_worker_id", hybrid_runbook_worker_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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_hybrid_runbook_worker_group_request( # pylint: disable=name-too-long - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_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", "2022-08-08")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "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"), - "hybridRunbookWorkerGroupName": _SERIALIZER.url( - "hybrid_runbook_worker_group_name", hybrid_runbook_worker_group_name, "str" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - 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 HybridRunbookWorkersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`hybrid_runbook_workers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = 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, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - **kwargs: Any - ) -> 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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. - :type hybrid_runbook_worker_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, - hybrid_runbook_worker_id=hybrid_runbook_worker_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. - :type hybrid_runbook_worker_id: str - :return: HybridRunbookWorker or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, - hybrid_runbook_worker_id=hybrid_runbook_worker_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("HybridRunbookWorker", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - hybrid_runbook_worker_creation_parameters: _models.HybridRunbookWorkerCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :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. Required. - :type hybrid_runbook_worker_creation_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: HybridRunbookWorker or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - hybrid_runbook_worker_creation_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :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. Required. - :type hybrid_runbook_worker_creation_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: HybridRunbookWorker or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - hybrid_runbook_worker_creation_parameters: Union[_models.HybridRunbookWorkerCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :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 HybridRunbookWorkerCreateParameters type or a IO[bytes] type. - Required. - :type hybrid_runbook_worker_creation_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters or IO[bytes] - :return: HybridRunbookWorker or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - 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, (IOBase, bytes)): - _content = hybrid_runbook_worker_creation_parameters - else: - _json = self._serialize.body( - hybrid_runbook_worker_creation_parameters, "HybridRunbookWorkerCreateParameters" - ) - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, - hybrid_runbook_worker_id=hybrid_runbook_worker_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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("HybridRunbookWorker", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def move( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - hybrid_runbook_worker_move_parameters: _models.HybridRunbookWorkerMoveParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> 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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :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. - Required. - :type hybrid_runbook_worker_move_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerMoveParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def move( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - hybrid_runbook_worker_move_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> 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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :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. - Required. - :type hybrid_runbook_worker_move_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def move( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - hybrid_runbook_worker_id: str, - hybrid_runbook_worker_move_parameters: Union[_models.HybridRunbookWorkerMoveParameters, IO[bytes]], - **kwargs: Any - ) -> 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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :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 HybridRunbookWorkerMoveParameters type or a IO[bytes] type. Required. - :type hybrid_runbook_worker_move_parameters: - ~azure.mgmt.automation.models.HybridRunbookWorkerMoveParameters or IO[bytes] - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - 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, (IOBase, bytes)): - _content = hybrid_runbook_worker_move_parameters - else: - _json = self._serialize.body(hybrid_runbook_worker_move_parameters, "HybridRunbookWorkerMoveParameters") - - _request = build_move_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, - hybrid_runbook_worker_id=hybrid_runbook_worker_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_by_hybrid_runbook_worker_group( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> 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. - :type automation_account_name: str - :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. - :type hybrid_runbook_worker_group_name: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :return: An iterator like instance of either HybridRunbookWorker or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.HybridRunbookWorker] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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-08-08")) - cls: ClsType[_models.HybridRunbookWorkersListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_hybrid_runbook_worker_group_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("HybridRunbookWorkersListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/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 9f12d52e13f8..fe0b2ecb9ae0 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,16 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -26,14 +29,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -51,14 +52,14 @@ def build_get_output_request( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "text/plain") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/output", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -93,14 +94,14 @@ def build_get_runbook_content_request( _headers = case_insensitive_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-08-08")) - accept = _headers.pop("Accept", "text/powershell") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/runbookContent", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -135,14 +136,14 @@ def build_suspend_request( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/suspend", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -177,14 +178,14 @@ 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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/stop", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -219,14 +220,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -261,7 +262,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -269,7 +270,7 @@ def build_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -306,14 +307,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -349,14 +350,14 @@ 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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/resume", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -391,12 +392,12 @@ class JobOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get_output( @@ -406,7 +407,7 @@ def get_output( job_name: str, client_request_id: Optional[str] = None, **kwargs: Any - ) -> str: + ) -> Iterator[bytes]: """Retrieve the job output identified by job name. .. seealso:: @@ -420,11 +421,11 @@ def get_output( :type job_name: str :param client_request_id: Identifies this specific client request. Default value is None. :type client_request_id: str - :return: str or the result of cls(response) - :rtype: str + :return: Iterator[bytes] or the result of cls(response) + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,8 +436,8 @@ def get_output( _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-08-08")) - cls: ClsType[str] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_get_output_request( resource_group_name=resource_group_name, @@ -450,7 +451,8 @@ def get_output( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -458,10 +460,14 @@ def get_output( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response.http_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -476,7 +482,7 @@ def get_runbook_content( job_name: str, client_request_id: Optional[str] = None, **kwargs: Any - ) -> str: + ) -> Iterator[bytes]: """Retrieve the runbook content of the job identified by job name. .. seealso:: @@ -490,11 +496,11 @@ def get_runbook_content( :type job_name: str :param client_request_id: Identifies this specific client request. Default value is None. :type client_request_id: str - :return: str or the result of cls(response) - :rtype: str + :return: Iterator[bytes] or the result of cls(response) + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -505,8 +511,8 @@ def get_runbook_content( _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-08-08")) - cls: ClsType[str] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_get_runbook_content_request( resource_group_name=resource_group_name, @@ -520,7 +526,8 @@ def get_runbook_content( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -528,10 +535,18 @@ def get_runbook_content( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response.http_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -564,7 +579,7 @@ def suspend( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,7 +590,7 @@ def suspend( # 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_suspend_request( @@ -599,7 +614,10 @@ def suspend( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -631,7 +649,7 @@ def stop( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -642,7 +660,7 @@ def stop( # 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_stop_request( @@ -666,7 +684,10 @@ def stop( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -698,7 +719,7 @@ def get( :rtype: ~azure.mgmt.automation.models.Job :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -709,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) _request = build_get_request( @@ -733,7 +754,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Job", pipeline_response.http_response) @@ -843,7 +867,7 @@ def create( :rtype: ~azure.mgmt.automation.models.Job :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -854,7 +878,7 @@ def 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -890,7 +914,10 @@ def create( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Job", pipeline_response.http_response) @@ -908,7 +935,7 @@ def list_by_automation_account( filter: Optional[str] = None, client_request_id: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.JobCollectionItem"]: + ) -> ItemPaged["_models.JobCollectionItem"]: """Retrieve a list of jobs. .. seealso:: @@ -929,10 +956,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.JobListResultV2] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -979,7 +1006,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1012,7 +1042,7 @@ def resume( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1023,7 +1053,7 @@ def resume( # 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_resume_request( @@ -1047,7 +1077,10 @@ def resume( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: 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 ef27bd3221c9..6e4a44bb4a05 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,14 +44,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -79,14 +78,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -113,7 +112,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", "2022-08-08")) + 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") @@ -121,7 +120,7 @@ def build_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -155,14 +154,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -196,12 +195,12 @@ class JobScheduleOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -222,7 +221,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -233,7 +232,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", "2022-08-08")) + 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( @@ -256,7 +255,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -281,7 +283,7 @@ def get( :rtype: ~azure.mgmt.automation.models.JobSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -292,7 +294,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) _request = build_get_request( @@ -315,7 +317,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("JobSchedule", pipeline_response.http_response) @@ -416,7 +421,7 @@ def create( :rtype: ~azure.mgmt.automation.models.JobSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +432,7 @@ def 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-08-08")) + 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.JobSchedule] = kwargs.pop("cls", None) @@ -462,7 +467,10 @@ def create( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("JobSchedule", pipeline_response.http_response) @@ -475,7 +483,7 @@ def create( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.JobSchedule"]: + ) -> ItemPaged["_models.JobSchedule"]: """Retrieve a list of job schedules. .. seealso:: @@ -494,10 +502,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.JobScheduleListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -543,7 +551,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 1f9344ccced1..c7712af0490f 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,14 +26,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -51,14 +50,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams/{jobStreamId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -95,14 +94,14 @@ def build_list_by_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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -139,12 +138,12 @@ class JobStreamOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( @@ -175,7 +174,7 @@ def get( :rtype: ~azure.mgmt.automation.models.JobStream :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,7 +185,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) _request = build_get_request( @@ -211,7 +210,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("JobStream", pipeline_response.http_response) @@ -230,7 +232,7 @@ def list_by_job( filter: Optional[str] = None, client_request_id: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.JobStream"]: + ) -> ItemPaged["_models.JobStream"]: """Retrieve a list of jobs streams identified by job name. .. seealso:: @@ -253,10 +255,10 @@ def list_by_job( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -304,7 +306,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 7e4ad0127fb8..35d28f436823 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code 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, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,14 +25,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,14 +42,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listKeys", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -82,12 +81,12 @@ class KeysOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_automation_account( @@ -103,7 +102,7 @@ def list_by_automation_account( :rtype: ~azure.mgmt.automation.models.KeyListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +113,7 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) _request = build_list_by_automation_account_request( @@ -136,7 +135,10 @@ def list_by_automation_account( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("KeyListResult", 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 cdb3dcd4d2e1..913add9b5ae4 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code 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, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,14 +25,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,14 +42,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/linkedWorkspace", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -82,12 +81,12 @@ class LinkedWorkspaceOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> _models.LinkedWorkspace: @@ -104,7 +103,7 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: :rtype: ~azure.mgmt.automation.models.LinkedWorkspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -115,7 +114,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.LinkedWorkspace] = kwargs.pop("cls", None) _request = build_get_request( @@ -137,7 +136,10 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("LinkedWorkspace", 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 4fa315903480..2e8fcdfc0bb1 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,14 +44,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{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, pattern=r"^[-\w\._]+$" @@ -79,14 +78,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{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, pattern=r"^[-\w\._]+$" @@ -113,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", "2022-08-08")) + 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") @@ -121,7 +120,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{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, pattern=r"^[-\w\._]+$" @@ -150,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", "2022-08-08")) + 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") @@ -158,7 +157,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{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, pattern=r"^[-\w\._]+$" @@ -187,14 +186,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -226,12 +225,12 @@ class ModuleOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -252,7 +251,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -263,7 +262,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", "2022-08-08")) + 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( @@ -286,7 +285,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -311,7 +313,7 @@ def get( :rtype: ~azure.mgmt.automation.models.Module :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,7 +324,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Module] = kwargs.pop("cls", None) _request = build_get_request( @@ -345,7 +347,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Module", pipeline_response.http_response) @@ -446,7 +451,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.Module :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -457,7 +462,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", "2022-08-08")) + 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.Module] = kwargs.pop("cls", None) @@ -492,7 +497,10 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Module", pipeline_response.http_response) @@ -593,7 +601,7 @@ def update( :rtype: ~azure.mgmt.automation.models.Module :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -604,7 +612,7 @@ def 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-08-08")) + 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.Module] = kwargs.pop("cls", None) @@ -639,7 +647,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Module", pipeline_response.http_response) @@ -652,7 +663,7 @@ def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> Iterable["_models.Module"]: + ) -> ItemPaged["_models.Module"]: """Retrieve a list of modules. .. seealso:: @@ -669,10 +680,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -717,7 +728,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 4178caf1583e..62f9828de1f3 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code 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, Type, TypeVar, Union +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar, Union +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,14 +25,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -47,14 +46,14 @@ 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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodecounts/{countType}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -87,12 +86,12 @@ class NodeCountInformationOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( @@ -118,7 +117,7 @@ def get( :rtype: ~azure.mgmt.automation.models.NodeCounts :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -129,7 +128,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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.NodeCounts] = kwargs.pop("cls", None) _request = build_get_request( @@ -152,7 +151,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("NodeCounts", 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 d1c3cc3bef93..eb22309a8345 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,15 +26,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -51,14 +50,14 @@ def build_list_by_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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/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, pattern=r"^[-\w\._]+$" @@ -92,14 +91,14 @@ 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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -132,14 +131,14 @@ def build_get_content_request( _headers = case_insensitive_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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}/content", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -173,12 +172,12 @@ class NodeReportsOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_node( @@ -188,7 +187,7 @@ def list_by_node( node_id: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.DscNodeReport"]: + ) -> ItemPaged["_models.DscNodeReport"]: """Retrieve the Dsc node report list by node id. .. seealso:: @@ -209,10 +208,10 @@ def list_by_node( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscNodeReportListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +258,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -287,7 +289,7 @@ def get( :rtype: ~azure.mgmt.automation.models.DscNodeReport :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -298,7 +300,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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[_models.DscNodeReport] = kwargs.pop("cls", None) _request = build_get_request( @@ -322,7 +324,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("DscNodeReport", pipeline_response.http_response) @@ -353,7 +358,7 @@ def get_content( :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -364,7 +369,7 @@ def get_content( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) cls: ClsType[JSON] = kwargs.pop("cls", None) _request = build_get_content_request( @@ -388,7 +393,10 @@ def get_content( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("object", 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 14c94d3ebed4..fff0590faad5 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,14 +26,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -49,14 +48,14 @@ def build_list_fields_by_module_and_type_request( # pylint: disable=name-too-lo _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/objectDataTypes/{typeName}/fields", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -84,14 +83,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/objectDataTypes/{typeName}/fields", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -124,17 +123,17 @@ class ObjectDataTypesOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_fields_by_module_and_type( self, resource_group_name: str, automation_account_name: str, module_name: str, type_name: str, **kwargs: Any - ) -> Iterable["_models.TypeField"]: + ) -> ItemPaged["_models.TypeField"]: """Retrieve a list of fields of a given type identified by module name. .. seealso:: @@ -155,10 +154,10 @@ def list_fields_by_module_and_type( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +204,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -215,7 +217,7 @@ def get_next(next_link=None): @distributed_trace def list_fields_by_type( self, resource_group_name: str, automation_account_name: str, type_name: str, **kwargs: Any - ) -> Iterable["_models.TypeField"]: + ) -> ItemPaged["_models.TypeField"]: """Retrieve a list of fields of a given type across all accessible modules. .. seealso:: @@ -234,10 +236,10 @@ def list_fields_by_type( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -283,7 +285,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 48c1d46f32db..3200e926c354 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,14 +25,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -42,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,15 +67,15 @@ class Operations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: """Lists all of the available Automation REST API operations. :return: An iterator like instance of either Operation or the result of cls(response) @@ -87,10 +85,10 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -132,7 +130,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_patch.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_patch.py index f7dd32510333..49900f6ab120 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_patch.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_patch.py @@ -2,6 +2,7 @@ # 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 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 deleted file mode 100644 index 367a4f502bfd..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,672 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_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", "2020-01-13-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/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, pattern=r"^[-\w\._]+$" - ), - "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_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, - automation_account_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", "2020-01-13-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/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, pattern=r"^[-\w\._]+$" - ), - "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "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_create_or_update_request( - resource_group_name: str, - automation_account_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", "2020-01-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.Automation/automationAccounts/{automationAccountName}/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, pattern=r"^[-\w\._]+$" - ), - "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "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, - automation_account_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", "2020-01-13-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/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, pattern=r"^[-\w\._]+$" - ), - "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "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.automation.AutomationClient`'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") - - @distributed_trace - def list_by_automation_account( - self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateEndpointConnection"]: - """List all private endpoint connections on a Automation account. - - :param resource_group_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 - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.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", "2020-01-13-preview")) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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 None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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) - - @distributed_trace - def get( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets a private endpoint connection. - - :param resource_group_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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PrivateEndpointConnection") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - parameters: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: ~azure.mgmt.automation.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.PrivateEndpointConnection or IO[bytes] - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_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-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) - lro_delay = kwargs.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, - automation_account_name=automation_account_name, - private_endpoint_connection_name=private_endpoint_connection_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - automation_account_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes a private endpoint connection with a given name. - - :param resource_group_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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - private_endpoint_connection_name=private_endpoint_connection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/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 deleted file mode 100644 index 51bcaec91899..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,162 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_automation_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", "2020-01-13-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/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, pattern=r"^[-\w\._]+$" - ), - "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_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 PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'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") - - @distributed_trace - def automation( - self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateLinkResource"]: - """Gets the private link resources that need to be created for Automation account. - - :param resource_group_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 - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.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", "2020-01-13-preview")) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_automation_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) 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 1861bc05d17a..8c66c525d690 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,14 +44,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -79,14 +78,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -113,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -121,7 +120,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -150,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -158,7 +157,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -187,14 +186,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -226,12 +225,12 @@ class Python2PackageOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -252,7 +251,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -263,7 +262,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -286,7 +285,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -311,7 +313,7 @@ def get( :rtype: ~azure.mgmt.automation.models.Module :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,7 +324,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.Module] = kwargs.pop("cls", None) _request = build_get_request( @@ -345,7 +347,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Module", pipeline_response.http_response) @@ -446,7 +451,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.Module :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -457,7 +462,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) @@ -492,7 +497,10 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Module", pipeline_response.http_response) @@ -593,7 +601,7 @@ def update( :rtype: ~azure.mgmt.automation.models.Module :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -604,7 +612,7 @@ def 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) @@ -639,7 +647,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Module", pipeline_response.http_response) @@ -652,7 +663,7 @@ def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> Iterable["_models.Module"]: + ) -> ItemPaged["_models.Module"]: """Retrieve a list of python 2 packages. .. seealso:: @@ -669,10 +680,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -717,7 +728,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 deleted file mode 100644 index a1c584644e47..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python3_package_operations.py +++ /dev/null @@ -1,725 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, 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.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, automation_account_name: str, 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", "2022-08-08")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python3Packages/{packageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "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"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # 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, 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", "2022-08-08")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python3Packages/{packageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "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"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_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, 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", "2022-08-08")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/python3Packages/{packageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "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"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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, 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", "2022-08-08")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/python3Packages/{packageName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "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"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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", "2022-08-08")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python3Packages", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "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"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_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 Python3PackageOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`python3_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 delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, package_name: str, **kwargs: Any - ) -> 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. - :type automation_account_name: str - :param package_name: The python package name. Required. - :type package_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - package_name=package_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, package_name: str, **kwargs: Any - ) -> _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. - :type automation_account_name: str - :param package_name: The python package name. Required. - :type package_name: str - :return: Module or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Module - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - cls: ClsType[_models.Module] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - package_name=package_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Module", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - package_name: str, - parameters: _models.PythonPackageCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. Required. - :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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, - package_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: 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, - package_name: str, - parameters: Union[_models.PythonPackageCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _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 - PythonPackageCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or IO[bytes] - :return: Module or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Module - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - 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, "PythonPackageCreateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - package_name=package_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 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("Module", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - package_name: str, - parameters: _models.PythonPackageUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. Required. - :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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, - package_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: 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, - package_name: str, - parameters: Union[_models.PythonPackageUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _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 - PythonPackageUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or IO[bytes] - :return: Module or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Module - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) - 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, "PythonPackageUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - package_name=package_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Module", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @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 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. - :type automation_account_name: str - :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", "2022-08-08")) - cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) 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 56b31a6817d7..ed0999086a94 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code 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, Type, TypeVar, Union, cast +from collections.abc import MutableMapping +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -28,14 +29,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -47,21 +46,21 @@ def build_get_content_request( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "text/powershell") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -87,7 +86,7 @@ def build_replace_content_request( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -95,14 +94,14 @@ def build_replace_content_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -124,21 +123,21 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -158,21 +157,21 @@ def build_undo_edit_request( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -198,12 +197,12 @@ class RunbookDraftOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get_content( @@ -224,7 +223,7 @@ def get_content( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -235,7 +234,7 @@ def get_content( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_get_content_request( @@ -280,7 +279,7 @@ def _replace_content_initial( runbook_content: IO[bytes], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -291,7 +290,7 @@ def _replace_content_initial( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) @@ -324,7 +323,10 @@ def _replace_content_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -358,7 +360,7 @@ def begin_replace_content( :type automation_account_name: str :param runbook_name: The runbook name. Required. :type runbook_name: str - :param runbook_content: The runbook draft content. Required. + :param runbook_content: The runbook draft content. Required. :type runbook_content: IO[bytes] :return: An instance of LROPoller that returns either Iterator[bytes] or the result of cls(response) @@ -368,7 +370,7 @@ def begin_replace_content( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) 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) @@ -397,9 +399,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -434,7 +434,7 @@ def get( :rtype: ~azure.mgmt.automation.models.RunbookDraft :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,7 +445,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.RunbookDraft] = kwargs.pop("cls", None) _request = build_get_request( @@ -468,7 +468,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("RunbookDraft", pipeline_response.http_response) @@ -497,7 +500,7 @@ def undo_edit( :rtype: ~azure.mgmt.automation.models.RunbookDraftUndoEditResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +511,7 @@ def undo_edit( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.RunbookDraftUndoEditResult] = kwargs.pop("cls", None) _request = build_undo_edit_request( @@ -531,7 +534,10 @@ def undo_edit( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("RunbookDraftUndoEditResult", 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 046eaee61268..f85ad9e1bf8f 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,14 +31,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -49,21 +48,21 @@ def build_publish_request( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/publish", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -83,21 +82,21 @@ def build_get_content_request( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "text/powershell") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -117,21 +116,21 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -151,7 +150,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -159,14 +158,14 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -188,7 +187,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -196,14 +195,14 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -225,21 +224,21 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -259,14 +258,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -298,17 +297,17 @@ class RunbookOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") def _publish_initial( self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +318,7 @@ def _publish_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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_publish_request( @@ -347,7 +346,10 @@ def _publish_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -382,7 +384,7 @@ def begin_publish( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -439,7 +441,7 @@ def get_content( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -450,7 +452,7 @@ def get_content( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_get_content_request( @@ -506,7 +508,7 @@ def get( :rtype: ~azure.mgmt.automation.models.Runbook :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,7 +519,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) _request = build_get_request( @@ -540,7 +542,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Runbook", pipeline_response.http_response) @@ -644,7 +649,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.Runbook :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -655,7 +660,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) @@ -690,7 +695,10 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Runbook", pipeline_response.http_response) @@ -791,7 +799,7 @@ def update( :rtype: ~azure.mgmt.automation.models.Runbook :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -802,7 +810,7 @@ def 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) @@ -837,7 +845,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Runbook", pipeline_response.http_response) @@ -866,7 +877,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -877,7 +888,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -900,7 +911,10 @@ def delete( # pylint: disable=inconsistent-return-statements 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -909,7 +923,7 @@ def delete( # pylint: disable=inconsistent-return-statements @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> Iterable["_models.Runbook"]: + ) -> ItemPaged["_models.Runbook"]: """Retrieve a list of runbooks. .. seealso:: @@ -926,10 +940,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.RunbookListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -974,7 +988,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 ccd44a875fb5..ee1e7b3902b8 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,7 +44,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-08-08")) + 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") @@ -53,7 +52,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -82,7 +81,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", "2022-08-08")) + 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") @@ -90,7 +89,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -119,14 +118,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -153,14 +152,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -187,14 +186,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -226,12 +225,12 @@ class ScheduleOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def create_or_update( @@ -326,7 +325,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.Schedule or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +336,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", "2022-08-08")) + 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[Optional[_models.Schedule]] = kwargs.pop("cls", None) @@ -372,7 +371,10 @@ def create_or_update( if response.status_code not in [200, 201, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -474,7 +476,7 @@ def update( :rtype: ~azure.mgmt.automation.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +487,7 @@ def 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-08-08")) + 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.Schedule] = kwargs.pop("cls", None) @@ -520,7 +522,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Schedule", pipeline_response.http_response) @@ -549,7 +554,7 @@ def get( :rtype: ~azure.mgmt.automation.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -560,7 +565,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) _request = build_get_request( @@ -583,7 +588,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Schedule", pipeline_response.http_response) @@ -612,7 +620,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -623,7 +631,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", "2022-08-08")) + 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( @@ -646,7 +654,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -655,7 +666,7 @@ def delete( # pylint: disable=inconsistent-return-statements @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> Iterable["_models.Schedule"]: + ) -> ItemPaged["_models.Schedule"]: """Retrieve a list of schedules. .. seealso:: @@ -672,10 +683,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.ScheduleListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -720,7 +731,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 19241fc84238..e7d143de4064 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code 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, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,14 +25,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -49,14 +48,14 @@ def build_get_by_id_request( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns/{softwareUpdateConfigurationMachineRunId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -95,14 +94,14 @@ 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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -142,12 +141,12 @@ class SoftwareUpdateConfigurationMachineRunsOperations: # pylint: disable=name- models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get_by_id( @@ -176,7 +175,7 @@ def get_by_id( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,7 +186,7 @@ def get_by_id( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SoftwareUpdateConfigurationMachineRun] = kwargs.pop("cls", None) _request = build_get_by_id_request( @@ -211,7 +210,10 @@ def get_by_id( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SoftwareUpdateConfigurationMachineRun", pipeline_response.http_response) @@ -256,7 +258,7 @@ def list( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRunListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +269,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SoftwareUpdateConfigurationMachineRunListResult] = kwargs.pop("cls", None) _request = build_list_request( @@ -293,7 +295,10 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize( 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 bd1fe3f8b742..c8e3342a9b1e 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code 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, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,14 +25,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -49,14 +48,14 @@ def build_get_by_id_request( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns/{softwareUpdateConfigurationRunId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -95,14 +94,14 @@ 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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -142,12 +141,12 @@ class SoftwareUpdateConfigurationRunsOperations: # pylint: disable=name-too-lon models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get_by_id( @@ -176,7 +175,7 @@ def get_by_id( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,7 +186,7 @@ def get_by_id( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SoftwareUpdateConfigurationRun] = kwargs.pop("cls", None) _request = build_get_by_id_request( @@ -211,7 +210,10 @@ def get_by_id( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SoftwareUpdateConfigurationRun", pipeline_response.http_response) @@ -256,7 +258,7 @@ def list( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +269,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SoftwareUpdateConfigurationRunListResult] = kwargs.pop("cls", None) _request = build_list_request( @@ -293,7 +295,10 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SoftwareUpdateConfigurationRunListResult", 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 177164de050d..a55dc194f94a 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,14 +26,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -50,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", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -58,7 +57,7 @@ def build_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -97,14 +96,14 @@ def build_get_by_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", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -141,14 +140,14 @@ 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", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -185,14 +184,14 @@ 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", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -228,12 +227,12 @@ class SoftwareUpdateConfigurationsOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def create( @@ -338,7 +337,7 @@ def create( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -349,7 +348,7 @@ def 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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) @@ -385,7 +384,10 @@ def create( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SoftwareUpdateConfiguration", pipeline_response.http_response) @@ -422,7 +424,7 @@ def get_by_name( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,7 +435,7 @@ def get_by_name( _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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) _request = build_get_by_name_request( @@ -457,7 +459,10 @@ def get_by_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SoftwareUpdateConfiguration", pipeline_response.http_response) @@ -494,7 +499,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -505,7 +510,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", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -529,7 +534,10 @@ def delete( # pylint: disable=inconsistent-return-statements 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -561,7 +569,7 @@ def list( :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +580,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", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SoftwareUpdateConfigurationListResult] = kwargs.pop("cls", None) _request = build_list_request( @@ -596,7 +604,10 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SoftwareUpdateConfigurationListResult", 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 ae0f54c21f62..956352d3d912 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -49,7 +48,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -57,7 +56,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -90,7 +89,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -98,7 +97,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -131,14 +130,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -169,14 +168,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -208,14 +207,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -249,12 +248,12 @@ class SourceControlOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def create_or_update( @@ -350,7 +349,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -361,7 +360,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) @@ -396,7 +395,10 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SourceControl", pipeline_response.http_response) @@ -497,7 +499,7 @@ def update( :rtype: ~azure.mgmt.automation.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +510,7 @@ def 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) @@ -543,7 +545,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SourceControl", pipeline_response.http_response) @@ -572,7 +577,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -583,7 +588,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -606,7 +611,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -631,7 +639,7 @@ def get( :rtype: ~azure.mgmt.automation.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -642,7 +650,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) _request = build_get_request( @@ -665,7 +673,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SourceControl", pipeline_response.http_response) @@ -678,7 +689,7 @@ def get( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.SourceControl"]: + ) -> ItemPaged["_models.SourceControl"]: """Retrieve a list of source controls. .. seealso:: @@ -697,10 +708,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SourceControlListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -746,7 +757,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 3c08b3580b64..7309ece1dc4c 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -50,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -58,7 +57,7 @@ def build_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -93,14 +92,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -134,14 +133,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -176,12 +175,12 @@ class SourceControlSyncJobOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def create( @@ -286,7 +285,7 @@ def create( :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -297,7 +296,7 @@ def 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControlSyncJob] = kwargs.pop("cls", None) @@ -333,7 +332,10 @@ def create( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SourceControlSyncJob", pipeline_response.http_response) @@ -369,7 +371,7 @@ def get( :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobById :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -380,7 +382,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SourceControlSyncJobById] = kwargs.pop("cls", None) _request = build_get_request( @@ -404,7 +406,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SourceControlSyncJobById", pipeline_response.http_response) @@ -422,7 +427,7 @@ def list_by_automation_account( source_control_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.SourceControlSyncJob"]: + ) -> ItemPaged["_models.SourceControlSyncJob"]: """Retrieve a list of source control sync jobs. .. seealso:: @@ -444,10 +449,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SourceControlSyncJobListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -494,7 +499,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 8cbe16483af5..d1f2fccea549 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,14 +26,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -51,14 +50,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -94,14 +93,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams/{streamId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -136,12 +135,12 @@ class SourceControlSyncJobStreamsOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_sync_job( @@ -152,7 +151,7 @@ def list_by_sync_job( source_control_sync_job_id: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.SourceControlSyncJobStream"]: + ) -> ItemPaged["_models.SourceControlSyncJobStream"]: """Retrieve a list of sync job streams identified by sync job id. .. seealso:: @@ -176,10 +175,10 @@ def list_by_sync_job( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SourceControlSyncJobStreamsListBySyncJob] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +226,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -263,7 +265,7 @@ def get( :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobStreamById :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -274,7 +276,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) cls: ClsType[_models.SourceControlSyncJobStreamById] = kwargs.pop("cls", None) _request = build_get_request( @@ -299,7 +301,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SourceControlSyncJobStreamById", 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 fa8e9486ac9f..784ddf26410a 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,14 +26,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -49,14 +48,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/statistics", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -90,17 +89,17 @@ class StatisticsOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.Statistics"]: + ) -> ItemPaged["_models.Statistics"]: """Retrieve the statistics for the account. .. seealso:: @@ -119,10 +118,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.StatisticsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +167,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 a2e9f3f7dc87..2296bcafe001 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,14 +26,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -44,7 +43,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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -52,14 +51,14 @@ def build_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -81,21 +80,21 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -115,21 +114,21 @@ 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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/resume", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -149,21 +148,21 @@ 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", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -183,21 +182,21 @@ def build_suspend_request( _headers = case_insensitive_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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/suspend", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -223,12 +222,12 @@ class TestJobOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def create( @@ -321,7 +320,7 @@ def create( :rtype: ~azure.mgmt.automation.models.TestJob :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -332,7 +331,7 @@ def 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) @@ -367,7 +366,10 @@ def create( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("TestJob", pipeline_response.http_response) @@ -396,7 +398,7 @@ def get( :rtype: ~azure.mgmt.automation.models.TestJob :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -407,7 +409,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) _request = build_get_request( @@ -430,7 +432,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("TestJob", pipeline_response.http_response) @@ -459,7 +464,7 @@ def resume( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +475,7 @@ def resume( # 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_resume_request( @@ -493,7 +498,10 @@ def resume( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -518,7 +526,7 @@ def stop( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -529,7 +537,7 @@ def stop( # 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_stop_request( @@ -552,7 +560,10 @@ def stop( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -577,7 +588,7 @@ def suspend( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -588,7 +599,7 @@ def suspend( # 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_suspend_request( @@ -611,7 +622,10 @@ def suspend( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: 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 badaf1afaaf3..d73c5404b369 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,14 +26,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -49,21 +48,21 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams/{jobStreamId}", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), "jobStreamId": _SERIALIZER.url("job_stream_id", job_stream_id, "str"), } @@ -90,21 +89,21 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams", - ) # pylint: disable=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, 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-Z-_0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -132,12 +131,12 @@ class TestJobStreamsOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( @@ -165,7 +164,7 @@ def get( :rtype: ~azure.mgmt.automation.models.JobStream :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -176,7 +175,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) _request = build_get_request( @@ -200,7 +199,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("JobStream", pipeline_response.http_response) @@ -218,7 +220,7 @@ def list_by_test_job( runbook_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.JobStream"]: + ) -> ItemPaged["_models.JobStream"]: """Retrieve a list of test job streams identified by runbook name. .. seealso:: @@ -239,10 +241,10 @@ def list_by_test_job( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -289,7 +291,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 50dc6442834b..e3c5140dfb0d 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,14 +26,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -44,14 +43,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/usages", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -83,17 +82,17 @@ class UsagesOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> Iterable["_models.Usage"]: + ) -> ItemPaged["_models.Usage"]: """Retrieve the usage for the account id. .. seealso:: @@ -110,10 +109,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +157,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 695581ec7d09..6b4ea3e33c7f 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,7 +44,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-08-08")) + 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") @@ -53,7 +52,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -82,7 +81,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", "2022-08-08")) + 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") @@ -90,7 +89,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -119,14 +118,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -153,14 +152,14 @@ 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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -187,14 +186,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -226,12 +225,12 @@ class VariableOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def create_or_update( @@ -326,7 +325,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.Variable :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +336,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", "2022-08-08")) + 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.Variable] = kwargs.pop("cls", None) @@ -372,7 +371,10 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Variable", pipeline_response.http_response) @@ -473,7 +475,7 @@ def update( :rtype: ~azure.mgmt.automation.models.Variable :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -484,7 +486,7 @@ def 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-08-08")) + 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.Variable] = kwargs.pop("cls", None) @@ -519,7 +521,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Variable", pipeline_response.http_response) @@ -548,7 +553,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -559,7 +564,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", "2022-08-08")) + 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( @@ -582,7 +587,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -607,7 +615,7 @@ def get( :rtype: ~azure.mgmt.automation.models.Variable :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -618,7 +626,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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) _request = build_get_request( @@ -641,7 +649,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Variable", pipeline_response.http_response) @@ -654,7 +665,7 @@ def get( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> Iterable["_models.Variable"]: + ) -> ItemPaged["_models.Variable"]: """Retrieve a list of variables. .. seealso:: @@ -671,10 +682,10 @@ def list_by_automation_account( _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-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.VariableListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -719,7 +730,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 e912b470dc4d..049596285968 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -45,7 +44,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", "2020-01-13-preview")) + 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") @@ -53,7 +52,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -82,14 +81,14 @@ 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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -116,7 +115,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", "2020-01-13-preview")) + 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") @@ -124,7 +123,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -153,14 +152,14 @@ 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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -187,14 +186,14 @@ 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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -221,14 +220,14 @@ 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", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/stop", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -260,14 +259,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -301,12 +300,12 @@ class WatcherOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def create_or_update( @@ -399,7 +398,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.Watcher :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +409,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", "2020-01-13-preview")) + 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.Watcher] = kwargs.pop("cls", None) @@ -445,7 +444,10 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Watcher", pipeline_response.http_response) @@ -474,7 +476,7 @@ def get( :rtype: ~azure.mgmt.automation.models.Watcher :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +487,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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) _request = build_get_request( @@ -508,7 +510,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Watcher", pipeline_response.http_response) @@ -609,7 +614,7 @@ def update( :rtype: ~azure.mgmt.automation.models.Watcher :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,7 +625,7 @@ def 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-01-13-preview")) + 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.Watcher] = kwargs.pop("cls", None) @@ -655,7 +660,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Watcher", pipeline_response.http_response) @@ -684,7 +692,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -695,7 +703,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", "2020-01-13-preview")) + 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( @@ -718,7 +726,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -743,7 +754,7 @@ def start( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -754,7 +765,7 @@ def start( # 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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_start_request( @@ -777,7 +788,10 @@ def start( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -802,7 +816,7 @@ def stop( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -813,7 +827,7 @@ def stop( # 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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_stop_request( @@ -836,7 +850,10 @@ def stop( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -845,7 +862,7 @@ def stop( # pylint: disable=inconsistent-return-statements @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.Watcher"]: + ) -> ItemPaged["_models.Watcher"]: """Retrieve a list of watchers. .. seealso:: @@ -864,10 +881,10 @@ def list_by_automation_account( _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-01-13-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.WatcherListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -913,7 +930,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_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 ef9fa5e2dc8a..9b7b37b0594a 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,14 +27,12 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import AutomationClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -52,7 +51,7 @@ def build_generate_uri_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/generateUri", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -85,7 +84,7 @@ def build_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -119,7 +118,7 @@ def build_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -154,7 +153,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -191,7 +190,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -232,7 +231,7 @@ def build_list_by_automation_account_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" @@ -266,12 +265,12 @@ class WebhookOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AutomationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def generate_uri(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> str: @@ -288,7 +287,7 @@ def generate_uri(self, resource_group_name: str, automation_account_name: str, * :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +320,10 @@ def generate_uri(self, resource_group_name: str, automation_account_name: str, * if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("str", pipeline_response.http_response) @@ -350,7 +352,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -384,7 +386,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -409,7 +414,7 @@ def get( :rtype: ~azure.mgmt.automation.models.Webhook :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -443,7 +448,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Webhook", pipeline_response.http_response) @@ -544,7 +552,7 @@ def create_or_update( :rtype: ~azure.mgmt.automation.models.Webhook :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -590,7 +598,10 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Webhook", pipeline_response.http_response) @@ -691,7 +702,7 @@ def update( :rtype: ~azure.mgmt.automation.models.Webhook :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -737,7 +748,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Webhook", pipeline_response.http_response) @@ -750,7 +764,7 @@ def update( @distributed_trace def list_by_automation_account( self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.Webhook"]: + ) -> ItemPaged["_models.Webhook"]: """Retrieve a list of webhooks. .. seealso:: @@ -772,7 +786,7 @@ def list_by_automation_account( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.WebhookListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -818,7 +832,10 @@ def get_next(next_link=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) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_by_job_stream_id.py b/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_by_job_stream_id.py index 0370d2121cfc..34ded308b8e8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_by_job_stream_id.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_by_job_stream_id.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/compilationJobStreamByJobStreamId.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/compilationJobStreamByJobStreamId.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_list.py b/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_list.py index 69fac35af76b..8e6b8c5929be 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_list.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/compilationJobStreamList.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/compilationJobStreamList.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_compilation_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_compilation_job.py index b8e496c696e9..2da03dd40cf9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_compilation_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_compilation_job.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/createCompilationJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/createCompilationJob.json if __name__ == "__main__": main() 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 2b493b70c91e..cef55169f6c4 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -45,6 +46,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/2015-10-31/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 32f749004516..10b580f76b5e 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 906c342af734..241bccb3a6a6 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -47,6 +48,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/2015-10-31/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 9ebe7f199b81..c43c8d50a088 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -46,6 +47,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/2015-10-31/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 881ffe38d2a8..4f15d9e8ec33 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -49,6 +50,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/2015-10-31/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 9b116f2a2012..947f94965bd3 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -46,6 +47,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/2015-10-31/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 6b0f35c3a81f..04839c31c98f 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -53,6 +54,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/2015-10-31/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 8b97a7fd18a7..3bb73c136261 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -54,6 +55,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/2018-01-15/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 60031b022195..9c486e332a38 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -50,6 +51,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/2015-10-31/examples/createOrUpdateModule.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 281a320d14e8..83e98666fab9 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -51,6 +52,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/2018-06-30/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 deleted file mode 100644 index 4a575bb3a6c6..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python3_package.py +++ /dev/null @@ -1,56 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python create_or_update_python3_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 = AutomationClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.python3_package.create_or_update( - resource_group_name="rg", - automation_account_name="myAutomationAccount33", - package_name="OmsCompositeResources", - parameters={ - "properties": { - "contentLink": { - "contentHash": { - "algorithm": "sha265", - "value": "07E108A962B81DD9C9BAA89BB47C0F6EE52B29E83758B07795E408D258B2B87A", - }, - "uri": "https://teststorage.blob.core.windows.net/dsccomposite/OmsCompositeResources.zip", - "version": "1.0.0.0", - } - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/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 0dd495e8c95a..8498d7f90ae6 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -57,6 +58,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/2018-06-30/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 df6827f35c0e..719652b771ee 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -49,6 +50,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/2015-10-31/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 2051e1ab82cb..06271a544af6 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -42,6 +43,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/2015-10-31/examples/createOrUpdateVariable.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_watcher.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_watcher.py index adfaad839c82..4682106957c7 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_watcher.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,10 +38,13 @@ def main(): parameters={ "etag": None, "location": None, + "name": "MyTestWatcher", "properties": { + "creationTime": "2016-11-01T04:22:47.7333333-07:00", "description": "This is a test watcher.", "executionFrequencyInSeconds": 60, "lastModifiedBy": None, + "lastModifiedTime": "2016-11-01T04:22:47.7333333-07:00", "scriptName": "MyTestWatcherRunbook", "scriptParameters": None, "scriptRunOn": "MyTestHybridWorkerGroup", @@ -52,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/createOrUpdateWatcher.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createOrUpdateWatcher.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_webhook.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_webhook.py index c623f757ad3e..1659da64c40e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_webhook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_webhook.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. 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 124279b78ff8..27b929513731 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -50,6 +51,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/2018-06-30/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 7a1a2ef8cc52..c268eed04fb2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,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/2018-06-30/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 21c7a0276da9..a77a254845ae 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,6 @@ def main(): ) -# 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/2015-10-31/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 6e3ee25dc7b6..a40f6dd90b2c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_certificate.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2015-10-31/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 5a0aede34e19..db5ba6219166 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,13 +31,14 @@ def main(): subscription_id="subid", ) - client.connection.delete( + response = 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/2015-10-31/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 021920d3bfcf..28e43890669a 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2015-10-31/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 7ed67c055345..8e277657bbbc 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2015-10-31/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 5891714faca5..6e26711363fd 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2015-10-31/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 54ea48a9ef7d..ea9a51c35b07 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,13 +31,14 @@ def main(): subscription_id="subid", ) - client.dsc_node.delete( + response = 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 +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/deleteDscNode.json if __name__ == "__main__": main() 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 9c9c1e22ed69..fa28096c1888 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2018-01-15/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 deleted file mode 100644 index 1562d3e9c23b..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker.py +++ /dev/null @@ -1,43 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python delete_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.delete( - resource_group_name="rg", - automation_account_name="myAutomationAccount20", - hybrid_runbook_worker_group_name="myGroup", - hybrid_runbook_worker_id="c010ad12-ef14-4a2a-aa9e-ef22c4745ddd", - ) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/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 1f04d428dd28..517b9e4298cb 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2015-10-31/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 2b5b097295de..22c69ad6b4ca 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2015-10-31/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 19b5ab3dca39..a42c42ce444a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_module.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2015-10-31/examples/deleteModule.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 66562e1fccc8..117f5f05dbf6 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2018-06-30/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 deleted file mode 100644 index 35135ec74ff4..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_python3_package.py +++ /dev/null @@ -1,42 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python delete_python3_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 = AutomationClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.python3_package.delete( - resource_group_name="rg", - automation_account_name="myAutomationAccount33", - package_name="OmsCompositeResources", - ) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/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 7f7417137c03..6749a3dbe9c4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_runbook.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2018-06-30/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 155fec22e92b..3999c134eedd 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_schedule.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2015-10-31/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 f6d03a28720b..56e4aabc35ea 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_variable.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_variable.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2015-10-31/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 0f5e527b3e10..46e64ab63b90 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_watcher.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/deleteWatcher.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteWatcher.json if __name__ == "__main__": main() 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 5cb27ce8e4d3..8887133895f1 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_webhook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_webhook.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. 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 deleted file mode 100644 index f86cab907cbc..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/deserialize_graph_runbook_content.py +++ /dev/null @@ -1,49 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python deserialize_graph_runbook_content.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info 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.convert_graph_runbook_content( - resource_group_name="rg", - automation_account_name="MyAutomationAccount", - parameters={ - "rawContent": { - "runbookDefinition": "AAEAAADAQAAAAAAAAAMAgAAAGJPcmNoZXN0cmF0b3IuR3JhcGhSdW5ib29rLk1vZGVsLCBWZXJzaW9uPTcuMy4wLjAsIEN1bHR....", - "runbookType": "GraphPowerShell", - "schemaVersion": "1.10", - } - }, - ) - print(response) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/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 dbcf81260843..42139690ba31 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,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/2015-10-31/examples/getActivityInAModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_agent_registration.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_agent_registration.py index 2bc7dcaddabf..5b9766469243 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_agent_registration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_agent_registration.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getAgentRegistration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/getAgentRegistration.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 1d19ccb5d2d2..948e2aef6b15 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 f8fb0eaee5cf..2edc93a90bed 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 b530bfd16d06..fe7fbe7e9e5c 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 112f56333758..30c9ea0a771a 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2015-10-31/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 ec4b5054e5b3..54d30999585e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_certificate.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/examples/getCertificate.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_compilation_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_compilation_job.py index 825278c23f5a..21663d3b55d8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_compilation_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_compilation_job.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getCompilationJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/getCompilationJob.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 1eaaacdc23cd..98e156118321 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 102d0a442017..d5f5c947f712 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 e0d13b966860..2a996d3a5f56 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_credential.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_credential.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/examples/getCredential.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_deleted_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_deleted_automation_account.py deleted file mode 100644 index 5e58ce87cbd9..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_deleted_automation_account.py +++ /dev/null @@ -1,39 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python get_deleted_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="subid", - ) - - response = client.deleted_automation_accounts.list_by_subscription() - print(response) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-01-31/examples/getDeletedAutomationAccount.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 5c61696eed14..59eb1060a128 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 f4864cea78e2..549586900c7b 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/examples/getDscConfigurationContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node.py index 7db59ba56d3f..51d0e3d4165f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getDscNode.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/getDscNode.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 462d5028e2d0..2bb783117c0e 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2018-01-15/examples/getDscNodeConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report.py index 84f583c63fd7..772ed7dbdffd 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getDscNodeReport.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/getDscNodeReport.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report_content.py index 1df8a0e9f91f..4390782ec545 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_report_content.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getDscNodeReportContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/getDscNodeReportContent.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 6da142fd6b4d..c9739caad7d6 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 c009392c12a6..d51a1e820351 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2015-10-31/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 d48eb91a8c41..6d49ef8ee537 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_module.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 df525b4530ea..66e5a73b7f55 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 c5d76a9315eb..383436716971 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/examples/getPagedlDscConfigurationsWithNameFilter.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 b81bbb76d425..a26a60cb2d42 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2018-06-30/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 deleted file mode 100644 index c9cb5e7393ee..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_python3_package.py +++ /dev/null @@ -1,43 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python get_python3_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 = AutomationClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.python3_package.get( - 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/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 59b66b934cc0..323b08bf6951 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2018-06-30/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 59d7c00d708d..dab881dd20a5 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2018-06-30/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 ecf87d437745..54780df84ed5 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2018-06-30/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 b62afb4e4f73..82a800638062 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2018-06-30/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 8516fdd0f501..0ffaca3bb372 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_schedule.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 80dce470fae6..096dc2a29d29 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 9df0b8082a8a..788facda64ca 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2018-06-30/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 bd9942ebb29e..b90b0305a996 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,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/2018-06-30/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 8345b9669af4..fba0e9496cdc 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 2459f3c72f78..8f093f019bd7 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_variable.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_variable.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/examples/getVariable.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_watcher.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_watcher.py index 075a8a4c3e6e..3c7306f47ede 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_watcher.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getWatcher.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getWatcher.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_webhook.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_webhook.py index 9143bac1cedc..6202e7508281 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_webhook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_webhook.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_get.py similarity index 89% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py rename to sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_get.py index 076f0498f37d..6200c6a970a8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-automation # USAGE - python get_hybrid_runbook_worker_group.py + python hybrid_runbook_worker_group_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, @@ -38,6 +39,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/2015-10-31/examples/hybridRunbookWorkerGroupGet.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/hybrid_runbook_worker_group_list.py similarity index 86% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker_group.py rename to sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_list.py index d6a80f6593e5..968300eb1a81 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker_group.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-automation # USAGE - python list_hybrid_runbook_worker_group.py + python hybrid_runbook_worker_group_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, @@ -31,13 +32,13 @@ def main(): ) response = client.hybrid_runbook_worker_group.list_by_automation_account( - resource_group_name="rg", + resource_group_name="udtest", automation_account_name="testaccount", ) for item in response: 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/2015-10-31/examples/hybridRunbookWorkerGroupList.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/hybrid_runbook_worker_group_update.py similarity index 82% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py rename to sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_update.py index 96b8158acf99..4027097f858c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-automation # USAGE - python get_hybrid_runbook_worker.py + python hybrid_runbook_worker_group_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, @@ -30,15 +31,15 @@ def main(): subscription_id="subid", ) - response = client.hybrid_runbook_workers.get( + response = client.hybrid_runbook_worker_group.update( resource_group_name="rg", automation_account_name="testaccount", hybrid_runbook_worker_group_name="TestHybridGroup", - hybrid_runbook_worker_id="c010ad12-ef14-4a2a-aa9e-ef22c4745ddd", + parameters={"credential": {"name": "myRunAsCredentialName"}}, ) 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/2015-10-31/examples/hybridRunbookWorkerGroupUpdate.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/job/create_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/create_job.py index 51c3e0412194..d5807285a722 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/create_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/create_job.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -45,6 +46,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/preview/2017-05-15-preview/examples/job/createJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job.py index e80855f8290c..decb4dfb512a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/preview/2017-05-15-preview/examples/job/getJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_output.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_output.py index 34a722de2e6b..dfc06c07342d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_output.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_output.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/preview/2017-05-15-preview/examples/job/getJobOutput.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_runbook_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_runbook_content.py index b35965b0b585..b92b946cb9f1 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_runbook_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_runbook_content.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/preview/2017-05-15-preview/examples/job/getJobRunbookContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_stream.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_stream.py index ae21fa845fa8..dd52cbb1a3f2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_stream.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_stream.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,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/preview/2017-05-15-preview/examples/job/getJobStream.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/job/list_job_streams_by_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/list_job_streams_by_job.py index c232e74b0847..7f9aad840e78 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/list_job_streams_by_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/list_job_streams_by_job.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,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/preview/2017-05-15-preview/examples/job/listJobStreamsByJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/job/list_jobs_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/list_jobs_by_automation_account.py index 5d1d6a16023b..a785965c8438 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/list_jobs_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/list_jobs_by_automation_account.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/preview/2017-05-15-preview/examples/job/listJobsByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/job/resume_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/resume_job.py index 106090cf85fe..858bac0bcfae 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/resume_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/resume_job.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/preview/2017-05-15-preview/examples/job/resumeJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/job/stop_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/stop_job.py index 71a9b3bbf343..4001ee9ed891 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/stop_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/stop_job.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/preview/2017-05-15-preview/examples/job/stopJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/job/suspend_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/suspend_job.py index 10a921caadc6..28283156eb9b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/suspend_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/suspend_job.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/preview/2017-05-15-preview/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 1d091a0b99c1..ac8ca4d6d7b6 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,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/2015-10-31/examples/listActivitiesByModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_all_dsc_nodes_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_all_dsc_nodes_by_automation_account.py index cbcbaa13f653..eb1c93a35954 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_all_dsc_nodes_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_all_dsc_nodes_by_automation_account.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listAllDscNodesByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listAllDscNodesByAutomationAccount.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 c09acb29fed9..be59634202d7 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 3eb175567278..dd20c0a8218d 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2015-10-31/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 a062928fc86d..f044a5b90c12 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2015-10-31/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 ce5f98428294..acd926a98d0c 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2015-10-31/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 267bf1857323..5cc0e0457130 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/examples/listCertificatesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_compilation_jobs_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_compilation_jobs_by_automation_account.py index 2f888903c6fd..e69bfc2bb6d9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_compilation_jobs_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_compilation_jobs_by_automation_account.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listCompilationJobsByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listCompilationJobsByAutomationAccount.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 f3a7d2d69c62..c96dd9b406dc 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 98b377a54c6a..9e6c8be08513 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 2192aecf1ebd..c865397200ce 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 96f65c2c8960..5cbfa402a1d0 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 828e6ddafb96..9e576119e164 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2018-01-15/examples/listDscNodeConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_reports_by_node.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_reports_by_node.py index d840bc47801d..38d33268b9a0 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_reports_by_node.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_reports_by_node.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listDscNodeReportsByNode.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listDscNodeReportsByNode.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 587de076fb21..7db1d94ae565 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,6 +41,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/2015-10-31/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 c08fd26e49c9..4473dec0fdfc 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,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/2015-10-31/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 deleted file mode 100644 index ab9ab368fe26..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker.py +++ /dev/null @@ -1,44 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python list_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.list_by_hybrid_runbook_worker_group( - resource_group_name="rg", - automation_account_name="testaccount", - hybrid_runbook_worker_group_name="TestHybridGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listHybridRunbookWorker.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 c77c0ab6fe8f..e6fb65308ca7 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/examples/listModulesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configuration_counts.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configuration_counts.py index 7f4bd7e2d624..e72e5db1e191 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configuration_counts.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configuration_counts.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodeConfigurationCounts.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodeConfigurationCounts.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 802a5bf0f740..f91556dbfbb2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2018-01-15/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 5b2a1dd08c1a..c9efc220c133 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2018-01-15/examples/listPagedDscNodeConfigurationsWithNoFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_reports_by_node.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_reports_by_node.py deleted file mode 100644 index 661384c40b96..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_reports_by_node.py +++ /dev/null @@ -1,44 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python list_paged_dsc_node_reports_by_node.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info 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.node_reports.list_by_node( - resource_group_name="rg", - automation_account_name="myAutomationAccount33", - node_id="nodeId", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodeReportsByNode.json -if __name__ == "__main__": - main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_status_counts.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_status_counts.py index 1a0ba7cbcf85..41713f261711 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_status_counts.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_status_counts.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodeStatusCounts.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodeStatusCounts.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_composite_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_composite_filter.py index 4ec9eedbd300..ef074e32959a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_composite_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_composite_filter.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithCompositeFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithCompositeFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_name_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_name_filter.py index e962db24a88e..e1f94d3cc998 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_name_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_name_filter.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithNameFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithNameFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_no_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_no_filter.py index c2e508e489d2..22ec32878443 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_no_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_no_filter.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithNoFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithNoFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_custom_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_custom_filter.py index 53da5b881cf8..37e5452491df 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_custom_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_custom_filter.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithNodeConfigurationCustomFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithNodeConfigurationCustomFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_not_assigned_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_not_assigned_filter.py index 9456fcda2be3..738d16291a6f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_not_assigned_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_node_configuration_not_assigned_filter.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithNodeConfigurationNotAssignedFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithNodeConfigurationNotAssignedFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_status_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_status_filter.py index e048cf4cfac0..46e5a6bdd4a8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_status_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_status_filter.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithStatusFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithStatusFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_version_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_version_filter.py index fe2822958fed..5cc375196659 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_version_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_nodes_by_automation_account_with_version_filter.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listPagedDscNodesByAutomationAccountWithVersionFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithVersionFilter.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 89b6c30d141b..d77b27763195 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2018-06-30/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 deleted file mode 100644 index 83bae23c3d21..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_python3_packages_by_automation_account.py +++ /dev/null @@ -1,43 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python list_python3_packages_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="subid", - ) - - response = client.python3_package.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/2022-08-08/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 deleted file mode 100644 index 101fedcf2f46..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_rest_api_operations.py +++ /dev/null @@ -1,40 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python list_rest_api_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 = AutomationClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.operations.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/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 29b4e1ff8865..a404bc33250f 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2018-06-30/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 f3bf7c7b5753..9e63726471aa 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 b445264ef04e..a61fbf59d017 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 0d5656b9bb0e..f102d954ab29 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,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/2018-06-30/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 939d797553c0..f81fbfe3acc4 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 3eff82dd7952..0fae595bd585 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/examples/listVariables_Next100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_watchers_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_watchers_by_automation_account.py index 875b9f5aad88..0eae088ea88d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_watchers_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_watchers_by_automation_account.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/listWatchersByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listWatchersByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_webhooks_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_webhooks_by_automation_account.py index aeba21f7af44..468008f3d584 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_webhooks_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_webhooks_by_automation_account.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. 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 deleted file mode 100644 index c5d94257f205..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_delete.py +++ /dev/null @@ -1,42 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python private_endpoint_connection_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 = AutomationClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", - ) - - client.private_endpoint_connections.begin_delete( - resource_group_name="rg1", - automation_account_name="ddb1", - private_endpoint_connection_name="privateEndpointConnectionName", - ).result() - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/PrivateEndpointConnectionDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_get.py b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_get.py deleted file mode 100644 index 3a187bf89a0b..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_get.py +++ /dev/null @@ -1,43 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python private_endpoint_connection_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 = AutomationClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", - ) - - response = client.private_endpoint_connections.get( - resource_group_name="rg1", - automation_account_name="ddb1", - private_endpoint_connection_name="privateEndpointConnectionName", - ) - print(response) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/PrivateEndpointConnectionGet.json -if __name__ == "__main__": - main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_list_get.py b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_list_get.py deleted file mode 100644 index 85ea3a55fd8d..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_list_get.py +++ /dev/null @@ -1,43 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python private_endpoint_connection_list_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 = AutomationClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", - ) - - response = client.private_endpoint_connections.list_by_automation_account( - resource_group_name="rg1", - automation_account_name="ddb1", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/PrivateEndpointConnectionListGet.json -if __name__ == "__main__": - main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_update.py b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_update.py deleted file mode 100644 index 9f21bc166882..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_update.py +++ /dev/null @@ -1,51 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python private_endpoint_connection_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 = AutomationClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", - ) - - response = client.private_endpoint_connections.begin_create_or_update( - resource_group_name="rg1", - automation_account_name="ddb1", - private_endpoint_connection_name="privateEndpointConnectionName", - parameters={ - "properties": { - "privateLinkServiceConnectionState": { - "description": "Approved by johndoe@contoso.com", - "status": "Approved", - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/PrivateEndpointConnectionUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/private_link_resource_list_get.py b/sdk/automation/azure-mgmt-automation/generated_samples/private_link_resource_list_get.py deleted file mode 100644 index 13292b098f19..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/private_link_resource_list_get.py +++ /dev/null @@ -1,43 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python private_link_resource_list_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 = AutomationClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", - ) - - response = client.private_link_resources.automation( - resource_group_name="rg1", - automation_account_name="ddb1", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/PrivateLinkResourceListGet.json -if __name__ == "__main__": - main() 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 973e4a547b29..2d57ddb14e1e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/publish_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/publish_runbook.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ).result() -# 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/2018-06-30/examples/publishRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/regenerate_agent_registration_key.py b/sdk/automation/azure-mgmt-automation/generated_samples/regenerate_agent_registration_key.py index 56eda5a2fae1..a9785c8056ab 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/regenerate_agent_registration_key.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/regenerate_agent_registration_key.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/regenerateAgentRegistrationKey.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/regenerateAgentRegistrationKey.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 5da3ec9fad43..30ad2f86932c 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,6 +79,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/2018-06-30/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 bb6a97f7a025..8fbb4015c7e7 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2018-06-30/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 deleted file mode 100644 index 222ab365c372..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/serialize_graph_runbook_content.py +++ /dev/null @@ -1,43 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python serialize_graph_runbook_content.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info 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.convert_graph_runbook_content( - resource_group_name="rg", - automation_account_name="MyAutomationAccount", - parameters={"graphRunbookJson": ""}, - ) - print(response) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/serializeGraphRunbookContent.json -if __name__ == "__main__": - main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/create_software_update_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/create_software_update_configuration.py index 1a608daf41d9..6df39a280363 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/create_software_update_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/create_software_update_configuration.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -67,10 +68,10 @@ def main(): ], "tagSettings": { "filterOperator": "All", - "tags": { - "tag1": ["tag1Value1", "tag1Value2", "tag1Value3"], - "tag2": ["tag2Value1", "tag2Value2", "tag2Value3"], - }, + "tags": [ + {"tag1": ["tag1Value1", "tag1Value2", "tag1Value3"]}, + {"tag2": ["tag2Value1", "tag2Value2", "tag2Value3"]}, + ], }, } ], @@ -91,6 +92,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/softwareUpdateConfiguration/createSoftwareUpdateConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfiguration/createSoftwareUpdateConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/delete_software_update_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/delete_software_update_configuration.py index 4860444270ac..716a83fe463b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/delete_software_update_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/delete_software_update_configuration.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/softwareUpdateConfiguration/deleteSoftwareUpdateConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfiguration/deleteSoftwareUpdateConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/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 index 70bbcd54b012..ada04f3b8ab9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/softwareUpdateConfiguration/getSoftwareUpdateConfigurationByName.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfiguration/getSoftwareUpdateConfigurationByName.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations.py index fe1173dad307..e98dbede8ed0 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/softwareUpdateConfiguration/listSoftwareUpdateConfigurations.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfiguration/listSoftwareUpdateConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/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 index 0b62afe1a129..3e14d3559dea 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/softwareUpdateConfiguration/listSoftwareUpdateConfigurationsByVm.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfiguration/listSoftwareUpdateConfigurationsByVm.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/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 index 10be30ba1c57..37d3a1c56136 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/preview/2017-05-15-preview/examples/softwareUpdateConfigurationMachineRun/getSoftwareUpdateConfigurationMachineRunById.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/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 index 0a5b1be28b81..0bf99ed805fa 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/preview/2017-05-15-preview/examples/softwareUpdateConfigurationMachineRun/listSoftwareUpdateConfigurationMachineRuns.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/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 index df3ecdfebadb..9e3a7e056be1 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/preview/2017-05-15-preview/examples/softwareUpdateConfigurationMachineRun/listSoftwareUpdateConfigurationMachineRunsByRun.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/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 index 8f0d22504e1c..c7558a186bfe 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/preview/2017-05-15-preview/examples/softwareUpdateConfigurationRun/getSoftwareUpdateConfigurationRunById.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/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 index e56ef71fd25c..3a28d065005d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/preview/2017-05-15-preview/examples/softwareUpdateConfigurationRun/listFailedSoftwareUpdateConfigurationRuns.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_software_update_configuration_runs.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_software_update_configuration_runs.py index fdf7df941e06..1ac8ec83f171 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_software_update_configuration_runs.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_software_update_configuration_runs.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/preview/2017-05-15-preview/examples/softwareUpdateConfigurationRun/listSoftwareUpdateConfigurationRuns.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/create_or_update_source_control.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/create_or_update_source_control.py index 61c04091108c..201cbb66cf35 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/create_or_update_source_control.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/create_or_update_source_control.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -50,6 +51,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/preview/2017-05-15-preview/examples/sourceControl/createOrUpdateSourceControl.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/delete_source_control.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/delete_source_control.py index 22be9405d9dd..fc4ca6877482 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/delete_source_control.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/delete_source_control.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/preview/2017-05-15-preview/examples/sourceControl/deleteSourceControl.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_all_source_controls.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_all_source_controls.py index 359d3c5ce389..78a93c799308 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_all_source_controls.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_all_source_controls.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/preview/2017-05-15-preview/examples/sourceControl/getAllSourceControls.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_source_control.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_source_control.py index 070c9fd71d20..a0711f4dad28 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_source_control.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_source_control.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/preview/2017-05-15-preview/examples/sourceControl/getSourceControl.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/update_source_control_patch.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/update_source_control_patch.py index d34218b9e6f4..7044683c1667 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/update_source_control_patch.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/update_source_control_patch.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -48,6 +49,6 @@ def main(): 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/preview/2017-05-15-preview/examples/sourceControl/updateSourceControl_patch.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/create_source_control_sync_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/create_source_control_sync_job.py index f7c35d05bc10..995875b4ef1f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/create_source_control_sync_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/create_source_control_sync_job.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,6 +41,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/preview/2017-05-15-preview/examples/sourceControlSyncJob/createSourceControlSyncJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/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 index 1e059f06a789..be6bd434b88a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,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/preview/2017-05-15-preview/examples/sourceControlSyncJob/getAllSourceControlSyncJobs.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_source_control_sync_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_source_control_sync_job.py index 3f5e5f23f14c..a599ed888af5 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_source_control_sync_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_source_control_sync_job.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,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/preview/2017-05-15-preview/examples/sourceControlSyncJob/getSourceControlSyncJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/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 index bb1e987f19c2..319e5faef95e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,6 +41,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/preview/2017-05-15-preview/examples/sourceControlSyncJobStreams/getSourceControlSyncJobStreams.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/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 index 780b444b46fe..65e7e8053a54 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,6 +41,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/preview/2017-05-15-preview/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 1a3e21177d58..dd232da138ce 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/start_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/start_watcher.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/startWatcher.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/startWatcher.json if __name__ == "__main__": main() 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 158d9a00f06d..06c76a13be5d 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2018-06-30/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 ae4333efca6f..f68ee6fa6f33 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/stop_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/stop_watcher.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/stopWatcher.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/stopWatcher.json if __name__ == "__main__": main() 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 ed9117b25f55..8ee0512ee193 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# 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/2018-06-30/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 fc1d4816a700..fa03a20da1d2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2018-06-30/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 114151f2625e..aa75c14313ac 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/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 3e0ce7ca415f..e5901f9c03e2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_certificate.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,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/2015-10-31/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 bfa3d4743350..9f8a7da7c0f1 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_connection.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -48,6 +49,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/2015-10-31/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 56d40d8b4906..972b2a00f434 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -46,6 +47,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/2015-10-31/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 f7a24077b27e..8c36b093a4ee 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2015-10-31/examples/updateDscConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_node.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_node.py index c7b099834651..f7d76584a0c3 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_node.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_node.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -42,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/updateDscNode.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/updateDscNode.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 a7bdc4aad44c..800966f70aae 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -50,6 +51,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/2015-10-31/examples/updateModule.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 a4a3ea98fd67..01c00c7dc620 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,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/2018-06-30/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 deleted file mode 100644 index 256145744f3f..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_python3_package.py +++ /dev/null @@ -1,44 +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.automation import AutomationClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-automation -# USAGE - python update_python3_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 = AutomationClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.python3_package.update( - resource_group_name="rg", - automation_account_name="MyAutomationAccount", - package_name="MyPython3Package", - parameters={"tags": {}}, - ) - print(response) - - -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/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 751924e59c1a..f5653b8c965b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_runbook.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -46,6 +47,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/2018-06-30/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 38c74a101cac..f2c93ec51faf 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_schedule.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -42,6 +43,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/2015-10-31/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 8ea86d4d0c6b..93197be7c21e 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,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/2015-10-31/examples/updateVariable_patch.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_watcher.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_watcher.py index f752cf3666f8..78a9289c8d2d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_watcher.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/updateWatcher.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/updateWatcher.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_webhook.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_webhook.py index 9554b836849a..d8a1cd25df2f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_webhook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_webhook.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/webhook_generate_uri.py b/sdk/automation/azure-mgmt-automation/generated_samples/webhook_generate_uri.py index 625199184011..e77bcc86cc4a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/webhook_generate_uri.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/webhook_generate_uri.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/conftest.py b/sdk/automation/azure-mgmt-automation/generated_tests/conftest.py index 1b401bd0756c..36f067926275 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/conftest.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/conftest.py @@ -18,7 +18,7 @@ load_dotenv() -# aovid record sensitive identity information in recordings +# For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): automation_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_activity_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_activity_operations.py index 90dc45d7ecc9..e141812664e9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_activity_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_activity_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_activity_get(self, resource_group): response = self.client.activity.get( resource_group_name=resource_group.name, automation_account_name="str", module_name="str", activity_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_module(self, resource_group): + def test_activity_list_by_module(self, resource_group): response = self.client.activity.list_by_module( resource_group_name=resource_group.name, automation_account_name="str", module_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_activity_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_activity_operations_async.py index e7f250cc6fc7..c0be9720a467 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_activity_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_activity_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_activity_get(self, resource_group): response = await self.client.activity.get( resource_group_name=resource_group.name, automation_account_name="str", module_name="str", activity_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -35,12 +35,12 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_module(self, resource_group): + async def test_activity_list_by_module(self, resource_group): response = self.client.activity.list_by_module( resource_group_name=resource_group.name, automation_account_name="str", module_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_agent_registration_information_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_agent_registration_information_operations.py index dcfc1c6c2ba9..8f8b5619106d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_agent_registration_information_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_agent_registration_information_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_agent_registration_information_get(self, resource_group): response = self.client.agent_registration_information.get( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_regenerate_key(self, resource_group): + def test_agent_registration_information_regenerate_key(self, resource_group): response = self.client.agent_registration_information.regenerate_key( resource_group_name=resource_group.name, automation_account_name="str", parameters={"keyName": "str"}, - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_agent_registration_information_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_agent_registration_information_operations_async.py index 069b167f661c..65a8a7f5cb11 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_agent_registration_information_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_agent_registration_information_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_agent_registration_information_get(self, resource_group): response = await self.client.agent_registration_information.get( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_regenerate_key(self, resource_group): + async def test_agent_registration_information_regenerate_key(self, resource_group): response = await self.client.agent_registration_information.regenerate_key( resource_group_name=resource_group.name, automation_account_name="str", parameters={"keyName": "str"}, - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_automation_account_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_automation_account_operations.py index 826e87b5b82c..883075259e02 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_automation_account_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_automation_account_operations.py @@ -20,30 +20,17 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_automation_account_update(self, resource_group): response = self.client.automation_account.update( resource_group_name=resource_group.name, automation_account_name="str", parameters={ - "disableLocalAuth": bool, - "encryption": { - "identity": {"userAssignedIdentity": {}}, - "keySource": "str", - "keyVaultProperties": {"keyName": "str", "keyVersion": "str", "keyvaultUri": "str"}, - }, - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, "location": "str", "name": "str", - "publicNetworkAccess": bool, "sku": {"name": "str", "capacity": 0, "family": "str"}, "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -51,30 +38,17 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_automation_account_create_or_update(self, resource_group): response = self.client.automation_account.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", parameters={ - "disableLocalAuth": bool, - "encryption": { - "identity": {"userAssignedIdentity": {}}, - "keySource": "str", - "keyVaultProperties": {"keyName": "str", "keyVersion": "str", "keyvaultUri": "str"}, - }, - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, "location": "str", "name": "str", - "publicNetworkAccess": bool, "sku": {"name": "str", "capacity": 0, "family": "str"}, "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -82,11 +56,11 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_automation_account_delete(self, resource_group): response = self.client.automation_account.delete( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -94,11 +68,11 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_automation_account_get(self, resource_group): response = self.client.automation_account.get( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -106,10 +80,10 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): + def test_automation_account_list_by_resource_group(self, resource_group): response = self.client.automation_account.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself @@ -117,9 +91,9 @@ def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_automation_account_list(self, resource_group): response = self.client.automation_account.list( - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_automation_account_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_automation_account_operations_async.py index 5aaa5efc4db4..a1f17325b64b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_automation_account_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_automation_account_operations_async.py @@ -21,30 +21,17 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_automation_account_update(self, resource_group): response = await self.client.automation_account.update( resource_group_name=resource_group.name, automation_account_name="str", parameters={ - "disableLocalAuth": bool, - "encryption": { - "identity": {"userAssignedIdentity": {}}, - "keySource": "str", - "keyVaultProperties": {"keyName": "str", "keyVersion": "str", "keyvaultUri": "str"}, - }, - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, "location": "str", "name": "str", - "publicNetworkAccess": bool, "sku": {"name": "str", "capacity": 0, "family": "str"}, "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -52,30 +39,17 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_automation_account_create_or_update(self, resource_group): response = await self.client.automation_account.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", parameters={ - "disableLocalAuth": bool, - "encryption": { - "identity": {"userAssignedIdentity": {}}, - "keySource": "str", - "keyVaultProperties": {"keyName": "str", "keyVersion": "str", "keyvaultUri": "str"}, - }, - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, "location": "str", "name": "str", - "publicNetworkAccess": bool, "sku": {"name": "str", "capacity": 0, "family": "str"}, "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -83,11 +57,11 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_automation_account_delete(self, resource_group): response = await self.client.automation_account.delete( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -95,11 +69,11 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_automation_account_get(self, resource_group): response = await self.client.automation_account.get( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -107,10 +81,10 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_resource_group(self, resource_group): + async def test_automation_account_list_by_resource_group(self, resource_group): response = self.client.automation_account.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself @@ -118,9 +92,9 @@ async def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_automation_account_list(self, resource_group): response = self.client.automation_account.list( - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_certificate_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_certificate_operations.py index 8ccbd8d220c2..f0b11ca91505 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_certificate_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_certificate_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_certificate_delete(self, resource_group): response = self.client.certificate.delete( resource_group_name=resource_group.name, automation_account_name="str", certificate_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_certificate_get(self, resource_group): response = self.client.certificate.get( resource_group_name=resource_group.name, automation_account_name="str", certificate_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_certificate_create_or_update(self, resource_group): response = self.client.certificate.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -58,7 +58,7 @@ def test_create_or_update(self, resource_group): "isExportable": bool, "thumbprint": "str", }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -66,13 +66,13 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_certificate_update(self, resource_group): response = self.client.certificate.update( resource_group_name=resource_group.name, automation_account_name="str", certificate_name="str", parameters={"description": "str", "name": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -80,11 +80,11 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_certificate_list_by_automation_account(self, resource_group): response = self.client.certificate.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_certificate_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_certificate_operations_async.py index e57bad9afa3f..f11ba5996086 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_certificate_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_certificate_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_certificate_delete(self, resource_group): response = await self.client.certificate.delete( resource_group_name=resource_group.name, automation_account_name="str", certificate_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_certificate_get(self, resource_group): response = await self.client.certificate.get( resource_group_name=resource_group.name, automation_account_name="str", certificate_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -47,7 +47,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_certificate_create_or_update(self, resource_group): response = await self.client.certificate.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -59,7 +59,7 @@ async def test_create_or_update(self, resource_group): "isExportable": bool, "thumbprint": "str", }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -67,13 +67,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_certificate_update(self, resource_group): response = await self.client.certificate.update( resource_group_name=resource_group.name, automation_account_name="str", certificate_name="str", parameters={"description": "str", "name": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -81,11 +81,11 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_certificate_list_by_automation_account(self, resource_group): response = self.client.certificate.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_operations.py index 26c4ed542bd0..6a0557b2191d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_connection_delete(self, resource_group): response = self.client.connection.delete( resource_group_name=resource_group.name, automation_account_name="str", connection_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_connection_get(self, resource_group): response = self.client.connection.get( resource_group_name=resource_group.name, automation_account_name="str", connection_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_connection_create_or_update(self, resource_group): response = self.client.connection.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -57,7 +57,7 @@ def test_create_or_update(self, resource_group): "description": "str", "fieldDefinitionValues": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -65,13 +65,13 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_connection_update(self, resource_group): response = self.client.connection.update( resource_group_name=resource_group.name, automation_account_name="str", connection_name="str", parameters={"description": "str", "fieldDefinitionValues": {"str": "str"}, "name": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -79,11 +79,11 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_connection_list_by_automation_account(self, resource_group): response = self.client.connection.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_operations_async.py index 962e672ba755..54e00f7a4b41 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_connection_delete(self, resource_group): response = await self.client.connection.delete( resource_group_name=resource_group.name, automation_account_name="str", connection_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_connection_get(self, resource_group): response = await self.client.connection.get( resource_group_name=resource_group.name, automation_account_name="str", connection_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -47,7 +47,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_connection_create_or_update(self, resource_group): response = await self.client.connection.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -58,7 +58,7 @@ async def test_create_or_update(self, resource_group): "description": "str", "fieldDefinitionValues": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -66,13 +66,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_connection_update(self, resource_group): response = await self.client.connection.update( resource_group_name=resource_group.name, automation_account_name="str", connection_name="str", parameters={"description": "str", "fieldDefinitionValues": {"str": "str"}, "name": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -80,11 +80,11 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_connection_list_by_automation_account(self, resource_group): response = self.client.connection.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_type_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_type_operations.py index 3000097da240..b9bebbd8e322 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_type_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_type_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_connection_type_delete(self, resource_group): response = self.client.connection_type.delete( resource_group_name=resource_group.name, automation_account_name="str", connection_type_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_connection_type_get(self, resource_group): response = self.client.connection_type.get( resource_group_name=resource_group.name, automation_account_name="str", connection_type_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_connection_type_create_or_update(self, resource_group): response = self.client.connection_type.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -56,7 +56,7 @@ def test_create_or_update(self, resource_group): "name": "str", "isGlobal": bool, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -64,11 +64,11 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_connection_type_list_by_automation_account(self, resource_group): response = self.client.connection_type.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_type_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_type_operations_async.py index 60f6c4e88229..6cb10a005a23 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_type_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_connection_type_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_connection_type_delete(self, resource_group): response = await self.client.connection_type.delete( resource_group_name=resource_group.name, automation_account_name="str", connection_type_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_connection_type_get(self, resource_group): response = await self.client.connection_type.get( resource_group_name=resource_group.name, automation_account_name="str", connection_type_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -47,7 +47,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_connection_type_create_or_update(self, resource_group): response = await self.client.connection_type.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -57,7 +57,7 @@ async def test_create_or_update(self, resource_group): "name": "str", "isGlobal": bool, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -65,11 +65,11 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_connection_type_list_by_automation_account(self, resource_group): response = self.client.connection_type.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_credential_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_credential_operations.py index 1b3141fb9d9f..939e53e346d1 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_credential_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_credential_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_credential_delete(self, resource_group): response = self.client.credential.delete( resource_group_name=resource_group.name, automation_account_name="str", credential_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_credential_get(self, resource_group): response = self.client.credential.get( resource_group_name=resource_group.name, automation_account_name="str", credential_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -46,13 +46,13 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_credential_create_or_update(self, resource_group): response = self.client.credential.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", credential_name="str", parameters={"name": "str", "password": "str", "userName": "str", "description": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -60,13 +60,13 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_credential_update(self, resource_group): response = self.client.credential.update( resource_group_name=resource_group.name, automation_account_name="str", credential_name="str", parameters={"description": "str", "name": "str", "password": "str", "userName": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -74,11 +74,11 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_credential_list_by_automation_account(self, resource_group): response = self.client.credential.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_credential_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_credential_operations_async.py index 52cc29ac7b39..96d373713100 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_credential_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_credential_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_credential_delete(self, resource_group): response = await self.client.credential.delete( resource_group_name=resource_group.name, automation_account_name="str", credential_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_credential_get(self, resource_group): response = await self.client.credential.get( resource_group_name=resource_group.name, automation_account_name="str", credential_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -47,13 +47,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_credential_create_or_update(self, resource_group): response = await self.client.credential.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", credential_name="str", parameters={"name": "str", "password": "str", "userName": "str", "description": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -61,13 +61,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_credential_update(self, resource_group): response = await self.client.credential.update( resource_group_name=resource_group.name, automation_account_name="str", credential_name="str", parameters={"description": "str", "name": "str", "password": "str", "userName": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -75,11 +75,11 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_credential_list_by_automation_account(self, resource_group): response = self.client.credential.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_operations.py index 983d8ee3e766..547afb5b1a63 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create(self, resource_group): + def test_dsc_compilation_job_begin_create(self, resource_group): response = self.client.dsc_compilation_job.begin_create( resource_group_name=resource_group.name, automation_account_name="str", @@ -33,7 +33,7 @@ def test_begin_create(self, resource_group): "parameters": {"str": "str"}, "tags": {"str": "str"}, }, - api_version="2020-01-13-preview", + api_version="2018-01-15", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -41,12 +41,12 @@ def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_dsc_compilation_job_get(self, resource_group): response = self.client.dsc_compilation_job.get( resource_group_name=resource_group.name, automation_account_name="str", compilation_job_name="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -54,11 +54,11 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_dsc_compilation_job_list_by_automation_account(self, resource_group): response = self.client.dsc_compilation_job.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) result = [r for r in response] # please add some check logic here by yourself @@ -66,13 +66,13 @@ def test_list_by_automation_account(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_stream(self, resource_group): + def test_dsc_compilation_job_get_stream(self, resource_group): response = self.client.dsc_compilation_job.get_stream( resource_group_name=resource_group.name, automation_account_name="str", job_id="str", job_stream_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_operations_async.py index 9cd2ff9e93ed..74b99e31e657 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create(self, resource_group): + async def test_dsc_compilation_job_begin_create(self, resource_group): response = await ( await self.client.dsc_compilation_job.begin_create( resource_group_name=resource_group.name, @@ -35,7 +35,7 @@ async def test_begin_create(self, resource_group): "parameters": {"str": "str"}, "tags": {"str": "str"}, }, - api_version="2020-01-13-preview", + api_version="2018-01-15", ) ).result() # call '.result()' to poll until service return final result @@ -44,12 +44,12 @@ async def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_dsc_compilation_job_get(self, resource_group): response = await self.client.dsc_compilation_job.get( resource_group_name=resource_group.name, automation_account_name="str", compilation_job_name="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -57,11 +57,11 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_dsc_compilation_job_list_by_automation_account(self, resource_group): response = self.client.dsc_compilation_job.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) result = [r async for r in response] # please add some check logic here by yourself @@ -69,13 +69,13 @@ async def test_list_by_automation_account(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_stream(self, resource_group): + async def test_dsc_compilation_job_get_stream(self, resource_group): response = await self.client.dsc_compilation_job.get_stream( resource_group_name=resource_group.name, automation_account_name="str", job_id="str", job_stream_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_stream_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_stream_operations.py index 0a2c9c3d274a..72597d3434d1 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_stream_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_stream_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_job(self, resource_group): + def test_dsc_compilation_job_stream_list_by_job(self, resource_group): response = self.client.dsc_compilation_job_stream.list_by_job( resource_group_name=resource_group.name, automation_account_name="str", job_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_stream_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_stream_operations_async.py index 097698daaa7e..7c62999df624 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_stream_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_stream_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_job(self, resource_group): + async def test_dsc_compilation_job_stream_list_by_job(self, resource_group): response = await self.client.dsc_compilation_job_stream.list_by_job( resource_group_name=resource_group.name, automation_account_name="str", job_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_configuration_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_configuration_operations.py index d6d88071242a..4b1f93f3177b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_configuration_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_configuration_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_dsc_configuration_delete(self, resource_group): response = self.client.dsc_configuration.delete( resource_group_name=resource_group.name, automation_account_name="str", configuration_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_dsc_configuration_get(self, resource_group): response = self.client.dsc_configuration.get( resource_group_name=resource_group.name, automation_account_name="str", configuration_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_dsc_configuration_create_or_update(self, resource_group): response = self.client.dsc_configuration.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -66,7 +66,7 @@ def test_create_or_update(self, resource_group): "parameters": {"str": {"defaultValue": "str", "isMandatory": bool, "position": 0, "type": "str"}}, "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -74,12 +74,12 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_dsc_configuration_update(self, resource_group): response = self.client.dsc_configuration.update( resource_group_name=resource_group.name, automation_account_name="str", configuration_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -87,12 +87,12 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_content(self, resource_group): + def test_dsc_configuration_get_content(self, resource_group): response = self.client.dsc_configuration.get_content( resource_group_name=resource_group.name, automation_account_name="str", configuration_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -100,11 +100,11 @@ def test_get_content(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_dsc_configuration_list_by_automation_account(self, resource_group): response = self.client.dsc_configuration.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_configuration_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_configuration_operations_async.py index 24340c9332d5..4ce7f312e1b4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_configuration_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_configuration_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_dsc_configuration_delete(self, resource_group): response = await self.client.dsc_configuration.delete( resource_group_name=resource_group.name, automation_account_name="str", configuration_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_dsc_configuration_get(self, resource_group): response = await self.client.dsc_configuration.get( resource_group_name=resource_group.name, automation_account_name="str", configuration_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -47,7 +47,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_dsc_configuration_create_or_update(self, resource_group): response = await self.client.dsc_configuration.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -67,7 +67,7 @@ async def test_create_or_update(self, resource_group): "parameters": {"str": {"defaultValue": "str", "isMandatory": bool, "position": 0, "type": "str"}}, "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -75,12 +75,12 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_dsc_configuration_update(self, resource_group): response = await self.client.dsc_configuration.update( resource_group_name=resource_group.name, automation_account_name="str", configuration_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -88,12 +88,12 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_content(self, resource_group): + async def test_dsc_configuration_get_content(self, resource_group): response = await self.client.dsc_configuration.get_content( resource_group_name=resource_group.name, automation_account_name="str", configuration_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -101,11 +101,11 @@ async def test_get_content(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_dsc_configuration_list_by_automation_account(self, resource_group): response = self.client.dsc_configuration.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_configuration_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_configuration_operations.py index 361d17ae9f61..f935baea4eca 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_configuration_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_configuration_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_dsc_node_configuration_delete(self, resource_group): response = self.client.dsc_node_configuration.delete( resource_group_name=resource_group.name, automation_account_name="str", node_configuration_name="str", - api_version="2022-08-08", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_dsc_node_configuration_get(self, resource_group): response = self.client.dsc_node_configuration.get( resource_group_name=resource_group.name, automation_account_name="str", node_configuration_name="str", - api_version="2022-08-08", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_dsc_node_configuration_begin_create_or_update(self, resource_group): response = self.client.dsc_node_configuration.begin_create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -63,7 +63,7 @@ def test_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2018-01-15", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -71,11 +71,11 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_dsc_node_configuration_list_by_automation_account(self, resource_group): response = self.client.dsc_node_configuration.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2018-01-15", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_configuration_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_configuration_operations_async.py index f11525edd403..fff5e931b76f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_configuration_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_configuration_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_dsc_node_configuration_delete(self, resource_group): response = await self.client.dsc_node_configuration.delete( resource_group_name=resource_group.name, automation_account_name="str", node_configuration_name="str", - api_version="2022-08-08", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_dsc_node_configuration_get(self, resource_group): response = await self.client.dsc_node_configuration.get( resource_group_name=resource_group.name, automation_account_name="str", node_configuration_name="str", - api_version="2022-08-08", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -47,7 +47,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_dsc_node_configuration_begin_create_or_update(self, resource_group): response = await ( await self.client.dsc_node_configuration.begin_create_or_update( resource_group_name=resource_group.name, @@ -65,7 +65,7 @@ async def test_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2018-01-15", ) ).result() # call '.result()' to poll until service return final result @@ -74,11 +74,11 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_dsc_node_configuration_list_by_automation_account(self, resource_group): response = self.client.dsc_node_configuration.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2018-01-15", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_operations.py index 8cb548436357..730d120f6f53 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_dsc_node_delete(self, resource_group): response = self.client.dsc_node.delete( resource_group_name=resource_group.name, automation_account_name="str", node_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_dsc_node_get(self, resource_group): response = self.client.dsc_node.get( resource_group_name=resource_group.name, automation_account_name="str", node_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -46,13 +46,13 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_dsc_node_update(self, resource_group): response = self.client.dsc_node.update( resource_group_name=resource_group.name, automation_account_name="str", node_id="str", dsc_node_update_parameters={"nodeId": "str", "properties": {"name": "str"}}, - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -60,11 +60,11 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_dsc_node_list_by_automation_account(self, resource_group): response = self.client.dsc_node.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_operations_async.py index d793a8233cbe..0eb3ee0dfc0d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_node_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_dsc_node_delete(self, resource_group): response = await self.client.dsc_node.delete( resource_group_name=resource_group.name, automation_account_name="str", node_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_dsc_node_get(self, resource_group): response = await self.client.dsc_node.get( resource_group_name=resource_group.name, automation_account_name="str", node_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -47,13 +47,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_dsc_node_update(self, resource_group): response = await self.client.dsc_node.update( resource_group_name=resource_group.name, automation_account_name="str", node_id="str", dsc_node_update_parameters={"nodeId": "str", "properties": {"name": "str"}}, - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -61,11 +61,11 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_dsc_node_list_by_automation_account(self, resource_group): response = self.client.dsc_node.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_fields_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_fields_operations.py index 657bebde196f..1e547c8fcd4e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_fields_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_fields_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_type(self, resource_group): + def test_fields_list_by_type(self, resource_group): response = self.client.fields.list_by_type( resource_group_name=resource_group.name, automation_account_name="str", module_name="str", type_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_fields_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_fields_operations_async.py index 388ea94738f6..4e2a021b494c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_fields_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_fields_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_type(self, resource_group): + async def test_fields_list_by_type(self, resource_group): response = self.client.fields.list_by_type( resource_group_name=resource_group.name, automation_account_name="str", module_name="str", type_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_worker_group_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_worker_group_operations.py index 67564bf0c005..c4552028644f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_worker_group_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_worker_group_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_hybrid_runbook_worker_group_delete(self, resource_group): response = self.client.hybrid_runbook_worker_group.delete( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_hybrid_runbook_worker_group_get(self, resource_group): response = self.client.hybrid_runbook_worker_group.get( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -46,27 +46,13 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create(self, resource_group): - response = self.client.hybrid_runbook_worker_group.create( - resource_group_name=resource_group.name, - automation_account_name="str", - hybrid_runbook_worker_group_name="str", - hybrid_runbook_worker_group_creation_parameters={"credential": {"name": "str"}, "name": "str"}, - api_version="2022-08-08", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_update(self, resource_group): + def test_hybrid_runbook_worker_group_update(self, resource_group): response = self.client.hybrid_runbook_worker_group.update( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", - hybrid_runbook_worker_group_updation_parameters={"credential": {"name": "str"}, "name": "str"}, - api_version="2022-08-08", + parameters={"credential": {"name": "str"}}, + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -74,11 +60,11 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_hybrid_runbook_worker_group_list_by_automation_account(self, resource_group): response = self.client.hybrid_runbook_worker_group.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_worker_group_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_worker_group_operations_async.py index c69be76a3f3e..6ccfb71b8eb2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_worker_group_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_worker_group_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_hybrid_runbook_worker_group_delete(self, resource_group): response = await self.client.hybrid_runbook_worker_group.delete( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_hybrid_runbook_worker_group_get(self, resource_group): response = await self.client.hybrid_runbook_worker_group.get( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -47,27 +47,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create(self, resource_group): - response = await self.client.hybrid_runbook_worker_group.create( - resource_group_name=resource_group.name, - automation_account_name="str", - hybrid_runbook_worker_group_name="str", - hybrid_runbook_worker_group_creation_parameters={"credential": {"name": "str"}, "name": "str"}, - api_version="2022-08-08", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_hybrid_runbook_worker_group_update(self, resource_group): response = await self.client.hybrid_runbook_worker_group.update( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", - hybrid_runbook_worker_group_updation_parameters={"credential": {"name": "str"}, "name": "str"}, - api_version="2022-08-08", + parameters={"credential": {"name": "str"}}, + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -75,11 +61,11 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_hybrid_runbook_worker_group_list_by_automation_account(self, resource_group): response = self.client.hybrid_runbook_worker_group.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_operations.py index e63e5afdc275..d6f152acd57e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_output(self, resource_group): + def test_job_get_output(self, resource_group): response = self.client.job.get_output( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_get_output(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_runbook_content(self, resource_group): + def test_job_get_runbook_content(self, resource_group): response = self.client.job.get_runbook_content( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -46,12 +46,12 @@ def test_get_runbook_content(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_suspend(self, resource_group): + def test_job_suspend(self, resource_group): response = self.client.job.suspend( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -59,12 +59,12 @@ def test_suspend(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_stop(self, resource_group): + def test_job_stop(self, resource_group): response = self.client.job.stop( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -72,12 +72,12 @@ def test_stop(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_job_get(self, resource_group): response = self.client.job.get( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -85,13 +85,13 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create(self, resource_group): + def test_job_create(self, resource_group): response = self.client.job.create( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", parameters={"parameters": {"str": "str"}, "runOn": "str", "runbook": {"name": "str"}}, - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -99,11 +99,11 @@ def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_job_list_by_automation_account(self, resource_group): response = self.client.job.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -111,12 +111,12 @@ def test_list_by_automation_account(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_resume(self, resource_group): + def test_job_resume(self, resource_group): response = self.client.job.resume( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_operations_async.py index 2b93967f8087..302f7c39ce3c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_output(self, resource_group): + async def test_job_get_output(self, resource_group): response = await self.client.job.get_output( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ async def test_get_output(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_runbook_content(self, resource_group): + async def test_job_get_runbook_content(self, resource_group): response = await self.client.job.get_runbook_content( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -47,12 +47,12 @@ async def test_get_runbook_content(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_suspend(self, resource_group): + async def test_job_suspend(self, resource_group): response = await self.client.job.suspend( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -60,12 +60,12 @@ async def test_suspend(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_stop(self, resource_group): + async def test_job_stop(self, resource_group): response = await self.client.job.stop( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -73,12 +73,12 @@ async def test_stop(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_job_get(self, resource_group): response = await self.client.job.get( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -86,13 +86,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create(self, resource_group): + async def test_job_create(self, resource_group): response = await self.client.job.create( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", parameters={"parameters": {"str": "str"}, "runOn": "str", "runbook": {"name": "str"}}, - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -100,11 +100,11 @@ async def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_job_list_by_automation_account(self, resource_group): response = self.client.job.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -112,12 +112,12 @@ async def test_list_by_automation_account(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_resume(self, resource_group): + async def test_job_resume(self, resource_group): response = await self.client.job.resume( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_schedule_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_schedule_operations.py index 7faf5864ce52..b0c34e38f0cf 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_schedule_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_schedule_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_job_schedule_delete(self, resource_group): response = self.client.job_schedule.delete( resource_group_name=resource_group.name, automation_account_name="str", job_schedule_id="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_job_schedule_get(self, resource_group): response = self.client.job_schedule.get( resource_group_name=resource_group.name, automation_account_name="str", job_schedule_id="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create(self, resource_group): + def test_job_schedule_create(self, resource_group): response = self.client.job_schedule.create( resource_group_name=resource_group.name, automation_account_name="str", @@ -57,7 +57,7 @@ def test_create(self, resource_group): "parameters": {"str": "str"}, "runOn": "str", }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -65,11 +65,11 @@ def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_job_schedule_list_by_automation_account(self, resource_group): response = self.client.job_schedule.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_schedule_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_schedule_operations_async.py index 3ebbc24d1b48..c7136de4608f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_schedule_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_schedule_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_job_schedule_delete(self, resource_group): response = await self.client.job_schedule.delete( resource_group_name=resource_group.name, automation_account_name="str", job_schedule_id="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_job_schedule_get(self, resource_group): response = await self.client.job_schedule.get( resource_group_name=resource_group.name, automation_account_name="str", job_schedule_id="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -47,7 +47,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create(self, resource_group): + async def test_job_schedule_create(self, resource_group): response = await self.client.job_schedule.create( resource_group_name=resource_group.name, automation_account_name="str", @@ -58,7 +58,7 @@ async def test_create(self, resource_group): "parameters": {"str": "str"}, "runOn": "str", }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -66,11 +66,11 @@ async def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_job_schedule_list_by_automation_account(self, resource_group): response = self.client.job_schedule.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_stream_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_stream_operations.py index c1074efb57ea..8d34dbebfb3d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_stream_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_stream_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_job_stream_get(self, resource_group): response = self.client.job_stream.get( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", job_stream_id="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_job(self, resource_group): + def test_job_stream_list_by_job(self, resource_group): response = self.client.job_stream.list_by_job( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_stream_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_stream_operations_async.py index 493499a55942..c6d0d65882ad 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_stream_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_job_stream_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_job_stream_get(self, resource_group): response = await self.client.job_stream.get( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", job_stream_id="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -35,12 +35,12 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_job(self, resource_group): + async def test_job_stream_list_by_job(self, resource_group): response = self.client.job_stream.list_by_job( resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_keys_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_keys_operations.py index 300341acbc14..cba2f6e81d0e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_keys_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_keys_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_keys_list_by_automation_account(self, resource_group): response = self.client.keys.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_keys_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_keys_operations_async.py index ef68a825ad90..6ff3c770fa03 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_keys_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_keys_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_keys_list_by_automation_account(self, resource_group): response = await self.client.keys.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_linked_workspace_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_linked_workspace_operations.py index 610fb4f9b06d..b09e9ce8b374 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_linked_workspace_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_linked_workspace_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_linked_workspace_get(self, resource_group): response = self.client.linked_workspace.get( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_linked_workspace_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_linked_workspace_operations_async.py index f299edb64f00..c55e4b97c529 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_linked_workspace_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_linked_workspace_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_linked_workspace_get(self, resource_group): response = await self.client.linked_workspace.get( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_module_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_module_operations.py index 7cc86633ac2a..67fffb53ca38 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_module_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_module_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_module_delete(self, resource_group): response = self.client.module.delete( resource_group_name=resource_group.name, automation_account_name="str", module_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_module_get(self, resource_group): response = self.client.module.get( resource_group_name=resource_group.name, automation_account_name="str", module_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_module_create_or_update(self, resource_group): response = self.client.module.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -57,7 +57,7 @@ def test_create_or_update(self, resource_group): "name": "str", "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -65,7 +65,7 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_module_update(self, resource_group): response = self.client.module.update( resource_group_name=resource_group.name, automation_account_name="str", @@ -76,7 +76,7 @@ def test_update(self, resource_group): "name": "str", "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -84,11 +84,11 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_module_list_by_automation_account(self, resource_group): response = self.client.module.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_module_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_module_operations_async.py index 729b4a225570..46394f942b47 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_module_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_module_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_module_delete(self, resource_group): response = await self.client.module.delete( resource_group_name=resource_group.name, automation_account_name="str", module_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_module_get(self, resource_group): response = await self.client.module.get( resource_group_name=resource_group.name, automation_account_name="str", module_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -47,7 +47,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_module_create_or_update(self, resource_group): response = await self.client.module.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -58,7 +58,7 @@ async def test_create_or_update(self, resource_group): "name": "str", "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -66,7 +66,7 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_module_update(self, resource_group): response = await self.client.module.update( resource_group_name=resource_group.name, automation_account_name="str", @@ -77,7 +77,7 @@ async def test_update(self, resource_group): "name": "str", "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -85,11 +85,11 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_module_list_by_automation_account(self, resource_group): response = self.client.module.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_count_information_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_count_information_operations.py index 6fb52c220ab0..97a5b5c8b104 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_count_information_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_count_information_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_node_count_information_get(self, resource_group): response = self.client.node_count_information.get( resource_group_name=resource_group.name, automation_account_name="str", count_type="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_count_information_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_count_information_operations_async.py index 96782f7d1ade..1bf946fcae1f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_count_information_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_count_information_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_node_count_information_get(self, resource_group): response = await self.client.node_count_information.get( resource_group_name=resource_group.name, automation_account_name="str", count_type="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_reports_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_reports_operations.py index f97f92374aa2..74cb2be03335 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_reports_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_reports_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_node(self, resource_group): + def test_node_reports_list_by_node(self, resource_group): response = self.client.node_reports.list_by_node( resource_group_name=resource_group.name, automation_account_name="str", node_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,13 +33,13 @@ def test_list_by_node(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_node_reports_get(self, resource_group): response = self.client.node_reports.get( resource_group_name=resource_group.name, automation_account_name="str", node_id="str", report_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -47,13 +47,13 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_content(self, resource_group): + def test_node_reports_get_content(self, resource_group): response = self.client.node_reports.get_content( resource_group_name=resource_group.name, automation_account_name="str", node_id="str", report_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_reports_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_reports_operations_async.py index bbe8f5dcf3d1..1023335550b6 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_reports_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_node_reports_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_node(self, resource_group): + async def test_node_reports_list_by_node(self, resource_group): response = self.client.node_reports.list_by_node( resource_group_name=resource_group.name, automation_account_name="str", node_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,13 +34,13 @@ async def test_list_by_node(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_node_reports_get(self, resource_group): response = await self.client.node_reports.get( resource_group_name=resource_group.name, automation_account_name="str", node_id="str", report_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself @@ -48,13 +48,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_content(self, resource_group): + async def test_node_reports_get_content(self, resource_group): response = await self.client.node_reports.get_content( resource_group_name=resource_group.name, automation_account_name="str", node_id="str", report_id="str", - api_version="2020-01-13-preview", + api_version="2018-01-15", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_object_data_types_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_object_data_types_operations.py index d3d36455bb80..e12c783fb1cb 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_object_data_types_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_object_data_types_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_fields_by_module_and_type(self, resource_group): + def test_object_data_types_list_fields_by_module_and_type(self, resource_group): response = self.client.object_data_types.list_fields_by_module_and_type( resource_group_name=resource_group.name, automation_account_name="str", module_name="str", type_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself @@ -34,12 +34,12 @@ def test_list_fields_by_module_and_type(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_fields_by_type(self, resource_group): + def test_object_data_types_list_fields_by_type(self, resource_group): response = self.client.object_data_types.list_fields_by_type( resource_group_name=resource_group.name, automation_account_name="str", type_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_object_data_types_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_object_data_types_operations_async.py index 4c86bbb90848..65d25790aaf7 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_object_data_types_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_object_data_types_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_fields_by_module_and_type(self, resource_group): + async def test_object_data_types_list_fields_by_module_and_type(self, resource_group): response = self.client.object_data_types.list_fields_by_module_and_type( resource_group_name=resource_group.name, automation_account_name="str", module_name="str", type_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself @@ -35,12 +35,12 @@ async def test_list_fields_by_module_and_type(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_fields_by_type(self, resource_group): + async def test_object_data_types_list_fields_by_type(self, resource_group): response = self.client.object_data_types.list_fields_by_type( resource_group_name=resource_group.name, automation_account_name="str", type_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_operations.py index 5fb49d59f77b..54bace263cdc 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_operations.py @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_operations_async.py index abc9066a7546..405245218ab2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_operations_async.py @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python2_package_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python2_package_operations.py index c2fe15f5bc55..36ffc857f8eb 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python2_package_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python2_package_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_python2_package_delete(self, resource_group): response = self.client.python2_package.delete( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_python2_package_get(self, resource_group): response = self.client.python2_package.get( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_python2_package_create_or_update(self, resource_group): response = self.client.python2_package.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -55,7 +55,7 @@ def test_create_or_update(self, resource_group): "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"}, "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -63,13 +63,13 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_python2_package_update(self, resource_group): response = self.client.python2_package.update( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", parameters={"tags": {"str": "str"}}, - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -77,11 +77,11 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_python2_package_list_by_automation_account(self, resource_group): response = self.client.python2_package.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python2_package_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python2_package_operations_async.py index 017bda396152..83dcb2a54305 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python2_package_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python2_package_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_python2_package_delete(self, resource_group): response = await self.client.python2_package.delete( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_python2_package_get(self, resource_group): response = await self.client.python2_package.get( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -47,7 +47,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_python2_package_create_or_update(self, resource_group): response = await self.client.python2_package.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -56,7 +56,7 @@ async def test_create_or_update(self, resource_group): "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"}, "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -64,13 +64,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_python2_package_update(self, resource_group): response = await self.client.python2_package.update( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", parameters={"tags": {"str": "str"}}, - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -78,11 +78,11 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_python2_package_list_by_automation_account(self, resource_group): response = self.client.python2_package.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_draft_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_draft_operations.py index 2b2b13680f87..4f74c7a38139 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_draft_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_draft_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_content(self, resource_group): + def test_runbook_draft_get_content(self, resource_group): response = self.client.runbook_draft.get_content( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -33,13 +33,13 @@ def test_get_content(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_replace_content(self, resource_group): + def test_runbook_draft_begin_replace_content(self, resource_group): response = self.client.runbook_draft.begin_replace_content( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", runbook_content=b"bytes", - api_version="2022-08-08", + api_version="2018-06-30", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -47,12 +47,12 @@ def test_begin_replace_content(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_runbook_draft_get(self, resource_group): response = self.client.runbook_draft.get( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -60,12 +60,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_undo_edit(self, resource_group): + def test_runbook_draft_undo_edit(self, resource_group): response = self.client.runbook_draft.undo_edit( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_draft_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_draft_operations_async.py index 969c783ffb57..538989c934cb 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_draft_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_draft_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_content(self, resource_group): + async def test_runbook_draft_get_content(self, resource_group): response = await self.client.runbook_draft.get_content( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -34,14 +34,14 @@ async def test_get_content(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_replace_content(self, resource_group): + async def test_runbook_draft_begin_replace_content(self, resource_group): response = await ( await self.client.runbook_draft.begin_replace_content( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", runbook_content=b"bytes", - api_version="2022-08-08", + api_version="2018-06-30", ) ).result() # call '.result()' to poll until service return final result @@ -50,12 +50,12 @@ async def test_begin_replace_content(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_runbook_draft_get(self, resource_group): response = await self.client.runbook_draft.get( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -63,12 +63,12 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_undo_edit(self, resource_group): + async def test_runbook_draft_undo_edit(self, resource_group): response = await self.client.runbook_draft.undo_edit( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_operations.py index 1299b95388b4..ffcd7ccd02dc 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_publish(self, resource_group): + def test_runbook_begin_publish(self, resource_group): response = self.client.runbook.begin_publish( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_begin_publish(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_content(self, resource_group): + def test_runbook_get_content(self, resource_group): response = self.client.runbook.get_content( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -46,12 +46,12 @@ def test_get_content(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_runbook_get(self, resource_group): response = self.client.runbook.get( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -59,7 +59,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_runbook_create_or_update(self, resource_group): response = self.client.runbook.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -91,7 +91,7 @@ def test_create_or_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -99,7 +99,7 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_runbook_update(self, resource_group): response = self.client.runbook.update( resource_group_name=resource_group.name, automation_account_name="str", @@ -113,7 +113,7 @@ def test_update(self, resource_group): "name": "str", "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -121,12 +121,12 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_runbook_delete(self, resource_group): response = self.client.runbook.delete( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -134,11 +134,11 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_runbook_list_by_automation_account(self, resource_group): response = self.client.runbook.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_operations_async.py index 85f9eb7d5a48..842dabcbd5a9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runbook_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_publish(self, resource_group): + async def test_runbook_begin_publish(self, resource_group): response = await ( await self.client.runbook.begin_publish( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) ).result() # call '.result()' to poll until service return final result @@ -36,12 +36,12 @@ async def test_begin_publish(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_content(self, resource_group): + async def test_runbook_get_content(self, resource_group): response = await self.client.runbook.get_content( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -49,12 +49,12 @@ async def test_get_content(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_runbook_get(self, resource_group): response = await self.client.runbook.get( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -62,7 +62,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_runbook_create_or_update(self, resource_group): response = await self.client.runbook.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -94,7 +94,7 @@ async def test_create_or_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -102,7 +102,7 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_runbook_update(self, resource_group): response = await self.client.runbook.update( resource_group_name=resource_group.name, automation_account_name="str", @@ -116,7 +116,7 @@ async def test_update(self, resource_group): "name": "str", "tags": {"str": "str"}, }, - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -124,12 +124,12 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_runbook_delete(self, resource_group): response = await self.client.runbook.delete( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -137,11 +137,11 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_runbook_list_by_automation_account(self, resource_group): response = self.client.runbook.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_schedule_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_schedule_operations.py index 0eca2643de90..92198821ba76 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_schedule_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_schedule_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_schedule_create_or_update(self, resource_group): response = self.client.schedule.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -39,7 +39,7 @@ def test_create_or_update(self, resource_group): "interval": {}, "timeZone": "str", }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -47,13 +47,13 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_schedule_update(self, resource_group): response = self.client.schedule.update( resource_group_name=resource_group.name, automation_account_name="str", schedule_name="str", parameters={"description": "str", "isEnabled": bool, "name": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -61,12 +61,12 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_schedule_get(self, resource_group): response = self.client.schedule.get( resource_group_name=resource_group.name, automation_account_name="str", schedule_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -74,12 +74,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_schedule_delete(self, resource_group): response = self.client.schedule.delete( resource_group_name=resource_group.name, automation_account_name="str", schedule_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -87,11 +87,11 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_schedule_list_by_automation_account(self, resource_group): response = self.client.schedule.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_schedule_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_schedule_operations_async.py index f2894d5a68b9..7d99a6370a29 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_schedule_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_schedule_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_schedule_create_or_update(self, resource_group): response = await self.client.schedule.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -40,7 +40,7 @@ async def test_create_or_update(self, resource_group): "interval": {}, "timeZone": "str", }, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -48,13 +48,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_schedule_update(self, resource_group): response = await self.client.schedule.update( resource_group_name=resource_group.name, automation_account_name="str", schedule_name="str", parameters={"description": "str", "isEnabled": bool, "name": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -62,12 +62,12 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_schedule_get(self, resource_group): response = await self.client.schedule.get( resource_group_name=resource_group.name, automation_account_name="str", schedule_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -75,12 +75,12 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_schedule_delete(self, resource_group): response = await self.client.schedule.delete( resource_group_name=resource_group.name, automation_account_name="str", schedule_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -88,11 +88,11 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_schedule_list_by_automation_account(self, resource_group): response = self.client.schedule.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_machine_runs_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_machine_runs_operations.py index 957a5fba5ac6..cd04efd3b001 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_machine_runs_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_machine_runs_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_by_id(self, resource_group): + def test_software_update_configuration_machine_runs_get_by_id(self, resource_group): response = self.client.software_update_configuration_machine_runs.get_by_id( resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_machine_run_id="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -33,11 +33,11 @@ def test_get_by_id(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_software_update_configuration_machine_runs_list(self, resource_group): response = self.client.software_update_configuration_machine_runs.list( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_machine_runs_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_machine_runs_operations_async.py index 8aade45d68d8..6f9aed3f146d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_machine_runs_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_machine_runs_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_by_id(self, resource_group): + async def test_software_update_configuration_machine_runs_get_by_id(self, resource_group): response = await self.client.software_update_configuration_machine_runs.get_by_id( resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_machine_run_id="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -34,11 +34,11 @@ async def test_get_by_id(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_software_update_configuration_machine_runs_list(self, resource_group): response = await self.client.software_update_configuration_machine_runs.list( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_runs_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_runs_operations.py index d8b4e9b8ffd3..42cb2f36c140 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_runs_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_runs_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_by_id(self, resource_group): + def test_software_update_configuration_runs_get_by_id(self, resource_group): response = self.client.software_update_configuration_runs.get_by_id( resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_run_id="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -33,11 +33,11 @@ def test_get_by_id(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_software_update_configuration_runs_list(self, resource_group): response = self.client.software_update_configuration_runs.list( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_runs_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_runs_operations_async.py index fa11372e579a..5d76a3121b96 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_runs_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configuration_runs_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_by_id(self, resource_group): + async def test_software_update_configuration_runs_get_by_id(self, resource_group): response = await self.client.software_update_configuration_runs.get_by_id( resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_run_id="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -34,11 +34,11 @@ async def test_get_by_id(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_software_update_configuration_runs_list(self, resource_group): response = await self.client.software_update_configuration_runs.list( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configurations_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configurations_operations.py index 35f27fd47262..4f65d47c85bb 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configurations_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configurations_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create(self, resource_group): + def test_software_update_configurations_create(self, resource_group): response = self.client.software_update_configurations.create( resource_group_name=resource_group.name, automation_account_name="str", @@ -88,7 +88,7 @@ def test_create(self, resource_group): }, "type": "str", }, - api_version="2019-06-01", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -96,12 +96,12 @@ def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_by_name(self, resource_group): + def test_software_update_configurations_get_by_name(self, resource_group): response = self.client.software_update_configurations.get_by_name( resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_name="str", - api_version="2019-06-01", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -109,12 +109,12 @@ def test_get_by_name(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_software_update_configurations_delete(self, resource_group): response = self.client.software_update_configurations.delete( resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_name="str", - api_version="2019-06-01", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -122,11 +122,11 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_software_update_configurations_list(self, resource_group): response = self.client.software_update_configurations.list( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2019-06-01", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configurations_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configurations_operations_async.py index b0026a00f9fd..a9b92480d4a0 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configurations_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_software_update_configurations_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create(self, resource_group): + async def test_software_update_configurations_create(self, resource_group): response = await self.client.software_update_configurations.create( resource_group_name=resource_group.name, automation_account_name="str", @@ -89,7 +89,7 @@ async def test_create(self, resource_group): }, "type": "str", }, - api_version="2019-06-01", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -97,12 +97,12 @@ async def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_by_name(self, resource_group): + async def test_software_update_configurations_get_by_name(self, resource_group): response = await self.client.software_update_configurations.get_by_name( resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_name="str", - api_version="2019-06-01", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -110,12 +110,12 @@ async def test_get_by_name(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_software_update_configurations_delete(self, resource_group): response = await self.client.software_update_configurations.delete( resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_name="str", - api_version="2019-06-01", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -123,11 +123,11 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_software_update_configurations_list(self, resource_group): response = await self.client.software_update_configurations.list( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2019-06-01", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_operations.py index eccb5dab5a43..105303ca9600 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_source_control_create_or_update(self, resource_group): response = self.client.source_control.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -35,7 +35,7 @@ def test_create_or_update(self, resource_group): "securityToken": {"accessToken": "str", "refreshToken": "str", "tokenType": "str"}, "sourceType": "str", }, - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -43,7 +43,7 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_source_control_update(self, resource_group): response = self.client.source_control.update( resource_group_name=resource_group.name, automation_account_name="str", @@ -56,7 +56,7 @@ def test_update(self, resource_group): "publishRunbook": bool, "securityToken": {"accessToken": "str", "refreshToken": "str", "tokenType": "str"}, }, - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -64,12 +64,12 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_source_control_delete(self, resource_group): response = self.client.source_control.delete( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -77,12 +77,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_source_control_get(self, resource_group): response = self.client.source_control.get( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -90,11 +90,11 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_source_control_list_by_automation_account(self, resource_group): response = self.client.source_control.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_operations_async.py index 190f18485aa5..63ea7fa733e4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_source_control_create_or_update(self, resource_group): response = await self.client.source_control.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -36,7 +36,7 @@ async def test_create_or_update(self, resource_group): "securityToken": {"accessToken": "str", "refreshToken": "str", "tokenType": "str"}, "sourceType": "str", }, - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -44,7 +44,7 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_source_control_update(self, resource_group): response = await self.client.source_control.update( resource_group_name=resource_group.name, automation_account_name="str", @@ -57,7 +57,7 @@ async def test_update(self, resource_group): "publishRunbook": bool, "securityToken": {"accessToken": "str", "refreshToken": "str", "tokenType": "str"}, }, - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -65,12 +65,12 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_source_control_delete(self, resource_group): response = await self.client.source_control.delete( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -78,12 +78,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_source_control_get(self, resource_group): response = await self.client.source_control.get( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -91,11 +91,11 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_source_control_list_by_automation_account(self, resource_group): response = self.client.source_control.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_operations.py index 6217202a8a9d..1603126678e0 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_operations.py @@ -20,14 +20,14 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create(self, resource_group): + def test_source_control_sync_job_create(self, resource_group): response = self.client.source_control_sync_job.create( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", parameters={"commitId": "str"}, - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -35,13 +35,13 @@ def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_source_control_sync_job_get(self, resource_group): response = self.client.source_control_sync_job.get( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -49,12 +49,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_source_control_sync_job_list_by_automation_account(self, resource_group): response = self.client.source_control_sync_job.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_operations_async.py index c9827e3cc2eb..17b679ca38fb 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_operations_async.py @@ -21,14 +21,14 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create(self, resource_group): + async def test_source_control_sync_job_create(self, resource_group): response = await self.client.source_control_sync_job.create( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", parameters={"commitId": "str"}, - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -36,13 +36,13 @@ async def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_source_control_sync_job_get(self, resource_group): response = await self.client.source_control_sync_job.get( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -50,12 +50,12 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_source_control_sync_job_list_by_automation_account(self, resource_group): response = self.client.source_control_sync_job.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_streams_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_streams_operations.py index 5c8ca89e9d5c..38d245605d4c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_streams_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_streams_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_sync_job(self, resource_group): + def test_source_control_sync_job_streams_list_by_sync_job(self, resource_group): response = self.client.source_control_sync_job_streams.list_by_sync_job( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -34,14 +34,14 @@ def test_list_by_sync_job(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_source_control_sync_job_streams_get(self, resource_group): response = self.client.source_control_sync_job_streams.get( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", stream_id="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_streams_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_streams_operations_async.py index 1ba2ea096215..4bd7111ab8eb 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_streams_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_source_control_sync_job_streams_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_sync_job(self, resource_group): + async def test_source_control_sync_job_streams_list_by_sync_job(self, resource_group): response = self.client.source_control_sync_job_streams.list_by_sync_job( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -35,14 +35,14 @@ async def test_list_by_sync_job(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_source_control_sync_job_streams_get(self, resource_group): response = await self.client.source_control_sync_job_streams.get( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", stream_id="str", - api_version="2022-08-08", + api_version="2017-05-15-preview", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_statistics_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_statistics_operations.py index f3a7397ad834..00af04bc56c7 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_statistics_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_statistics_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_statistics_list_by_automation_account(self, resource_group): response = self.client.statistics.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_statistics_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_statistics_operations_async.py index 94d1f12747fc..fc8be9dafb5d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_statistics_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_statistics_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_statistics_list_by_automation_account(self, resource_group): response = self.client.statistics.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_operations.py index 2cbd264dd887..8d54cbcab659 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create(self, resource_group): + def test_test_job_create(self, resource_group): response = self.client.test_job.create( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", parameters={"parameters": {"str": "str"}, "runOn": "str"}, - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_test_job_get(self, resource_group): response = self.client.test_job.get( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -47,12 +47,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_resume(self, resource_group): + def test_test_job_resume(self, resource_group): response = self.client.test_job.resume( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -60,12 +60,12 @@ def test_resume(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_stop(self, resource_group): + def test_test_job_stop(self, resource_group): response = self.client.test_job.stop( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -73,12 +73,12 @@ def test_stop(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_suspend(self, resource_group): + def test_test_job_suspend(self, resource_group): response = self.client.test_job.suspend( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_operations_async.py index 4caac8bad20e..5e9b12dd41a9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create(self, resource_group): + async def test_test_job_create(self, resource_group): response = await self.client.test_job.create( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", parameters={"parameters": {"str": "str"}, "runOn": "str"}, - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -35,12 +35,12 @@ async def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_test_job_get(self, resource_group): response = await self.client.test_job.get( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -48,12 +48,12 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_resume(self, resource_group): + async def test_test_job_resume(self, resource_group): response = await self.client.test_job.resume( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -61,12 +61,12 @@ async def test_resume(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_stop(self, resource_group): + async def test_test_job_stop(self, resource_group): response = await self.client.test_job.stop( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -74,12 +74,12 @@ async def test_stop(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_suspend(self, resource_group): + async def test_test_job_suspend(self, resource_group): response = await self.client.test_job.suspend( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_streams_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_streams_operations.py index 6c29cc0e7a85..1d8ca8001a87 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_streams_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_streams_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_test_job_streams_get(self, resource_group): response = self.client.test_job_streams.get( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", job_stream_id="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -34,12 +34,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_test_job(self, resource_group): + def test_test_job_streams_list_by_test_job(self, resource_group): response = self.client.test_job_streams.list_by_test_job( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_streams_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_streams_operations_async.py index b9d205d4ee79..25ff39043237 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_streams_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_test_job_streams_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_test_job_streams_get(self, resource_group): response = await self.client.test_job_streams.get( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", job_stream_id="str", - api_version="2022-08-08", + api_version="2018-06-30", ) # please add some check logic here by yourself @@ -35,12 +35,12 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_test_job(self, resource_group): + async def test_test_job_streams_list_by_test_job(self, resource_group): response = self.client.test_job_streams.list_by_test_job( resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2022-08-08", + api_version="2018-06-30", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_usages_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_usages_operations.py index 2199eff6eb48..7677f2c1a2d6 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_usages_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_usages_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_usages_list_by_automation_account(self, resource_group): response = self.client.usages.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_usages_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_usages_operations_async.py index 90038264454d..9a145ec1f035 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_usages_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_usages_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_usages_list_by_automation_account(self, resource_group): response = self.client.usages.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_variable_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_variable_operations.py index 83feff4db0b5..9d44dc5253ac 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_variable_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_variable_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_variable_create_or_update(self, resource_group): response = self.client.variable.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", variable_name="str", parameters={"name": "str", "description": "str", "isEncrypted": bool, "value": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -34,13 +34,13 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_variable_update(self, resource_group): response = self.client.variable.update( resource_group_name=resource_group.name, automation_account_name="str", variable_name="str", parameters={"description": "str", "name": "str", "value": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -48,12 +48,12 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_variable_delete(self, resource_group): response = self.client.variable.delete( resource_group_name=resource_group.name, automation_account_name="str", variable_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -61,12 +61,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_variable_get(self, resource_group): response = self.client.variable.get( resource_group_name=resource_group.name, automation_account_name="str", variable_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -74,11 +74,11 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_variable_list_by_automation_account(self, resource_group): response = self.client.variable.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_variable_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_variable_operations_async.py index 1e3df50457f4..9b3eab48e163 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_variable_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_variable_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_variable_create_or_update(self, resource_group): response = await self.client.variable.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", variable_name="str", parameters={"name": "str", "description": "str", "isEncrypted": bool, "value": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -35,13 +35,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_variable_update(self, resource_group): response = await self.client.variable.update( resource_group_name=resource_group.name, automation_account_name="str", variable_name="str", parameters={"description": "str", "name": "str", "value": "str"}, - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -49,12 +49,12 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_variable_delete(self, resource_group): response = await self.client.variable.delete( resource_group_name=resource_group.name, automation_account_name="str", variable_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -62,12 +62,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_variable_get(self, resource_group): response = await self.client.variable.get( resource_group_name=resource_group.name, automation_account_name="str", variable_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -75,11 +75,11 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_variable_list_by_automation_account(self, resource_group): response = self.client.variable.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_watcher_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_watcher_operations.py index d7c9ee6897f4..fc3001bd1570 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_watcher_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_watcher_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_watcher_create_or_update(self, resource_group): response = self.client.watcher.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -42,7 +42,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2020-01-13-preview", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -50,12 +50,12 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_watcher_get(self, resource_group): response = self.client.watcher.get( resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", - api_version="2020-01-13-preview", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -63,13 +63,13 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_watcher_update(self, resource_group): response = self.client.watcher.update( resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", parameters={"executionFrequencyInSeconds": 0, "name": "str"}, - api_version="2020-01-13-preview", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -77,12 +77,12 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_watcher_delete(self, resource_group): response = self.client.watcher.delete( resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", - api_version="2020-01-13-preview", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -90,12 +90,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_start(self, resource_group): + def test_watcher_start(self, resource_group): response = self.client.watcher.start( resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", - api_version="2020-01-13-preview", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -103,12 +103,12 @@ def test_start(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_stop(self, resource_group): + def test_watcher_stop(self, resource_group): response = self.client.watcher.stop( resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", - api_version="2020-01-13-preview", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -116,11 +116,11 @@ def test_stop(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_watcher_list_by_automation_account(self, resource_group): response = self.client.watcher.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2020-01-13-preview", + api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_watcher_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_watcher_operations_async.py index 2ad268a76f2e..5664d4fa20d9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_watcher_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_watcher_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_watcher_create_or_update(self, resource_group): response = await self.client.watcher.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -43,7 +43,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2020-01-13-preview", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -51,12 +51,12 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_watcher_get(self, resource_group): response = await self.client.watcher.get( resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", - api_version="2020-01-13-preview", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -64,13 +64,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_watcher_update(self, resource_group): response = await self.client.watcher.update( resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", parameters={"executionFrequencyInSeconds": 0, "name": "str"}, - api_version="2020-01-13-preview", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -78,12 +78,12 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_watcher_delete(self, resource_group): response = await self.client.watcher.delete( resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", - api_version="2020-01-13-preview", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -91,12 +91,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_start(self, resource_group): + async def test_watcher_start(self, resource_group): response = await self.client.watcher.start( resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", - api_version="2020-01-13-preview", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -104,12 +104,12 @@ async def test_start(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_stop(self, resource_group): + async def test_watcher_stop(self, resource_group): response = await self.client.watcher.stop( resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", - api_version="2020-01-13-preview", + api_version="2015-10-31", ) # please add some check logic here by yourself @@ -117,11 +117,11 @@ async def test_stop(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_watcher_list_by_automation_account(self, resource_group): response = self.client.watcher.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2020-01-13-preview", + api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_webhook_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_webhook_operations.py index 8215ababf7db..900eb9ec3a51 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_webhook_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_webhook_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_generate_uri(self, resource_group): + def test_webhook_generate_uri(self, resource_group): response = self.client.webhook.generate_uri( resource_group_name=resource_group.name, automation_account_name="str", @@ -32,7 +32,7 @@ def test_generate_uri(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_webhook_delete(self, resource_group): response = self.client.webhook.delete( resource_group_name=resource_group.name, automation_account_name="str", @@ -45,7 +45,7 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_webhook_get(self, resource_group): response = self.client.webhook.get( resource_group_name=resource_group.name, automation_account_name="str", @@ -58,7 +58,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_webhook_create_or_update(self, resource_group): response = self.client.webhook.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -80,7 +80,7 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_webhook_update(self, resource_group): response = self.client.webhook.update( resource_group_name=resource_group.name, automation_account_name="str", @@ -100,7 +100,7 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_webhook_list_by_automation_account(self, resource_group): response = self.client.webhook.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_webhook_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_webhook_operations_async.py index a9d4126a34c9..69487bfcfb79 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_webhook_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_webhook_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_generate_uri(self, resource_group): + async def test_webhook_generate_uri(self, resource_group): response = await self.client.webhook.generate_uri( resource_group_name=resource_group.name, automation_account_name="str", @@ -33,7 +33,7 @@ async def test_generate_uri(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_webhook_delete(self, resource_group): response = await self.client.webhook.delete( resource_group_name=resource_group.name, automation_account_name="str", @@ -46,7 +46,7 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_webhook_get(self, resource_group): response = await self.client.webhook.get( resource_group_name=resource_group.name, automation_account_name="str", @@ -59,7 +59,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_webhook_create_or_update(self, resource_group): response = await self.client.webhook.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", @@ -81,7 +81,7 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_webhook_update(self, resource_group): response = await self.client.webhook.update( resource_group_name=resource_group.name, automation_account_name="str", @@ -101,7 +101,7 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_automation_account(self, resource_group): + async def test_webhook_list_by_automation_account(self, resource_group): response = self.client.webhook.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", diff --git a/sdk/automation/azure-mgmt-automation/pyproject.toml b/sdk/automation/azure-mgmt-automation/pyproject.toml index 540da07d41af..44cd995b73e1 100644 --- a/sdk/automation/azure-mgmt-automation/pyproject.toml +++ b/sdk/automation/azure-mgmt-automation/pyproject.toml @@ -1,6 +1,88 @@ +[build-system] +requires = [ + "setuptools>=77.0.3", + "wheel", +] +build-backend = "setuptools.build_meta" + +[project] +name = "azure-mgmt-automation" +authors = [ + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, +] +description = "Microsoft Azure Automation Management Client Library for Python" +license = "MIT" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +requires-python = ">=3.9" +keywords = [ + "azure", + "azure sdk", +] +dependencies = [ + "isodate>=0.6.1", + "azure-mgmt-core>=1.6.0", + "typing-extensions>=4.6.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +repository = "https://github.com/Azure/azure-sdk-for-python" + +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.automation._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "generated_tests*", + "samples*", + "generated_samples*", + "doc*", + "azure", + "azure.mgmt", +] + +[tool.setuptools.package-data] +pytyped = [ + "py.typed", +] + [tool.azure-sdk-build] breaking = false mypy = false pyright = false type_check_samples = false verifytypes = false + +[packaging] +package_name = "azure-mgmt-automation" +package_pprint_name = "Automation" +package_doc_id = "" +is_stable = true +is_arm = true +title = "AutomationClient" +package_nspkg = "azure-mgmt-nspkg" +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/automation/azure-mgmt-automation/sdk_packaging.toml b/sdk/automation/azure-mgmt-automation/sdk_packaging.toml deleted file mode 100644 index eb8a4d827878..000000000000 --- a/sdk/automation/azure-mgmt-automation/sdk_packaging.toml +++ /dev/null @@ -1,7 +0,0 @@ -[packaging] -package_name = "azure-mgmt-automation" -package_pprint_name = "Automation" -package_doc_id = "" -is_stable = false -is_arm = true -title = "AutomationClient" diff --git a/sdk/automation/azure-mgmt-automation/setup.py b/sdk/automation/azure-mgmt-automation/setup.py deleted file mode 100644 index 7a87494ce1bb..000000000000 --- a/sdk/automation/azure-mgmt-automation/setup.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/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-automation" -PACKAGE_PPRINT_NAME = "Automation" - -# 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>=0.6.1", - "typing-extensions>=4.6.0", - "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", - ], - python_requires=">=3.8", -)