From a6c3980b7f866a46a522ef17b795315fc0269c4c Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 27 May 2026 10:01:32 +0000 Subject: [PATCH 1/4] Configurations: 'specification/automation/Automation.Management/tspconfig.yaml', API Version: 2024-10-23, SDK Release Type: beta, and CommitSHA: 'da8db6e593df9f3ddc13139c39930fdad54d12f7' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6357293 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../azure-mgmt-automation/CHANGELOG.md | 289 + .../azure-mgmt-automation/_metadata.json | 15 +- .../apiview-properties.json | 1097 +- .../azure/mgmt/automation/__init__.py | 4 +- .../{_automation_client.py => _client.py} | 262 +- .../azure/mgmt/automation/_configuration.py | 18 +- .../azure/mgmt/automation/_patch.py | 13 +- .../azure/mgmt/automation/_utils/__init__.py | 2 +- .../mgmt/automation/_utils/model_base.py | 1755 ++ .../mgmt/automation/_utils/serialization.py | 31 +- .../azure/mgmt/automation/_utils/utils.py | 25 + .../azure/mgmt/automation/_version.py | 5 +- .../azure/mgmt/automation/aio/__init__.py | 4 +- .../aio/{_automation_client.py => _client.py} | 263 +- .../mgmt/automation/aio/_configuration.py | 18 +- .../azure/mgmt/automation/aio/_patch.py | 13 +- .../automation/aio/operations/__init__.py | 142 +- .../aio/operations/_activity_operations.py | 210 - ...ent_registration_information_operations.py | 258 - .../_automation_account_operations.py | 610 - .../aio/operations/_certificate_operations.py | 574 - .../aio/operations/_connection_operations.py | 579 - .../operations/_connection_type_operations.py | 423 - .../aio/operations/_credential_operations.py | 569 - .../_dsc_compilation_job_operations.py | 496 - .../_dsc_compilation_job_stream_operations.py | 119 - .../_dsc_configuration_operations.py | 663 - .../_dsc_node_configuration_operations.py | 507 - .../aio/operations/_dsc_node_operations.py | 441 - .../aio/operations/_fields_operations.py | 138 - ..._hybrid_runbook_worker_group_operations.py | 431 - .../aio/operations/_job_operations.py | 755 - .../operations/_job_schedule_operations.py | 420 - .../aio/operations/_job_stream_operations.py | 226 - .../aio/operations/_keys_operations.py | 113 - .../_linked_workspace_operations.py | 116 - .../aio/operations/_module_operations.py | 568 - .../_node_count_information_operations.py | 124 - .../operations/_node_reports_operations.py | 287 - .../_object_data_types_operations.py | 222 - .../automation/aio/operations/_operations.py | 20601 +++++++++++- .../mgmt/automation/aio/operations/_patch.py | 13 +- .../operations/_python2_package_operations.py | 568 - .../operations/_runbook_draft_operations.py | 405 - .../aio/operations/_runbook_operations.py | 762 - .../aio/operations/_schedule_operations.py | 571 - ...e_configuration_machine_runs_operations.py | 218 - ...re_update_configuration_runs_operations.py | 213 - ...ftware_update_configurations_operations.py | 442 - .../operations/_source_control_operations.py | 574 - .../_source_control_sync_job_operations.py | 388 - ...rce_control_sync_job_streams_operations.py | 228 - .../aio/operations/_statistics_operations.py | 135 - .../aio/operations/_test_job_operations.py | 462 - .../_test_job_streams_operations.py | 218 - .../aio/operations/_usages_operations.py | 132 - .../aio/operations/_variable_operations.py | 570 - .../aio/operations/_watcher_operations.py | 697 - .../aio/operations/_webhook_operations.py | 633 - .../azure/mgmt/automation/models/__init__.py | 302 +- ...{_automation_client_enums.py => _enums.py} | 261 +- .../azure/mgmt/automation/models/_models.py | 12200 ++++++++ .../mgmt/automation/models/_models_py3.py | 8201 ----- .../azure/mgmt/automation/models/_patch.py | 13 +- .../mgmt/automation/operations/__init__.py | 142 +- .../operations/_activity_operations.py | 286 - ...ent_registration_information_operations.py | 328 - .../_automation_account_operations.py | 795 - .../operations/_certificate_operations.py | 745 - .../operations/_connection_operations.py | 750 - .../operations/_connection_type_operations.py | 570 - .../operations/_credential_operations.py | 740 - .../_dsc_compilation_job_operations.py | 651 - .../_dsc_compilation_job_stream_operations.py | 156 - .../_dsc_configuration_operations.py | 883 - .../_dsc_node_configuration_operations.py | 669 - .../operations/_dsc_node_operations.py | 592 - .../operations/_fields_operations.py | 181 - ..._hybrid_runbook_worker_group_operations.py | 590 - .../automation/operations/_job_operations.py | 1087 - .../operations/_job_schedule_operations.py | 562 - .../operations/_job_stream_operations.py | 317 - .../automation/operations/_keys_operations.py | 149 - .../_linked_workspace_operations.py | 150 - .../operations/_module_operations.py | 739 - .../_node_count_information_operations.py | 165 - .../operations/_node_reports_operations.py | 407 - .../_object_data_types_operations.py | 296 - .../mgmt/automation/operations/_operations.py | 25824 +++++++++++++++- .../mgmt/automation/operations/_patch.py | 13 +- .../operations/_python2_package_operations.py | 739 - .../operations/_runbook_draft_operations.py | 548 - .../operations/_runbook_operations.py | 999 - .../operations/_schedule_operations.py | 742 - ...e_configuration_machine_runs_operations.py | 311 - ...re_update_configuration_runs_operations.py | 309 - ...ftware_update_configurations_operations.py | 618 - .../operations/_source_control_operations.py | 768 - .../_source_control_sync_job_operations.py | 510 - ...rce_control_sync_job_streams_operations.py | 315 - .../operations/_statistics_operations.py | 178 - .../operations/_test_job_operations.py | 632 - .../_test_job_streams_operations.py | 302 - .../operations/_usages_operations.py | 168 - .../operations/_variable_operations.py | 741 - .../operations/_watcher_operations.py | 941 - .../operations/_webhook_operations.py | 843 - .../generated_samples/{job => }/create_job.py | 7 +- .../generated_samples/create_job_schedule.py | 7 +- .../create_or_update_automation_account.py | 7 +- .../create_or_update_certificate.py | 7 +- .../create_or_update_connection.py | 12 +- .../create_or_update_connection_type.py | 7 +- .../create_or_update_credential.py | 7 +- .../create_or_update_dsc_configuration.py | 6 +- ...create_or_update_dsc_node_configuration.py | 6 +- .../create_or_update_module.py | 7 +- ...ion_job.py => create_or_update_package.py} | 28 +- .../create_or_update_python2_package.py | 7 +- .../create_or_update_python3_package.py | 56 + .../create_or_update_runbook.py | 9 +- .../create_or_update_schedule.py | 7 +- .../create_or_update_source_control.py | 7 +- .../create_or_update_variable.py | 7 +- .../create_or_update_watcher.py | 10 +- .../create_or_update_webhook.py | 7 +- .../create_runbook_as_draft.py | 10 +- .../create_runtime_environment.py | 50 + .../create_software_update_configuration.py | 14 +- .../create_source_control_sync_job.py | 7 +- .../generated_samples/create_test_job.py | 13 +- .../delete_automation_account.py | 7 +- .../generated_samples/delete_certificate.py | 7 +- .../generated_samples/delete_connection.py | 10 +- .../delete_connection_type.py | 7 +- .../delete_credential_existing.py | 7 +- .../delete_dsc_configuration.py | 7 +- .../generated_samples/delete_dsc_node.py | 10 +- .../delete_dsc_node_configuration.py | 7 +- .../delete_hybrid_runbook_worker.py | 43 + .../delete_hybrid_runbook_worker_group.py | 7 +- .../generated_samples/delete_job_schedule.py | 7 +- .../generated_samples/delete_module.py | 7 +- .../generated_samples/delete_package.py | 43 + .../delete_python2_package.py | 7 +- .../delete_python3_package.py | 42 + .../generated_samples/delete_runbook.py | 7 +- .../delete_runtime_environment.py | 42 + .../generated_samples/delete_schedule.py | 7 +- .../delete_software_update_configuration.py | 7 +- .../delete_source_control.py | 7 +- .../generated_samples/delete_variable.py | 7 +- .../generated_samples/delete_watcher.py | 7 +- .../generated_samples/delete_webhook.py | 7 +- ...y => deserialize_graph_runbook_content.py} | 21 +- .../get_activity_in_amodule.py | 7 +- .../get_agent_registration.py | 7 +- .../get_all_connection_types_first100.py | 7 +- .../get_all_connection_types_next100.py | 7 +- .../get_all_dsc_configurations.py | 7 +- .../get_all_source_control_sync_jobs.py | 7 +- .../get_all_source_controls.py | 7 +- .../get_automation_account.py | 7 +- .../generated_samples/get_certificate.py | 7 +- .../generated_samples/get_connection.py | 7 +- .../generated_samples/get_connection_type.py | 7 +- .../generated_samples/get_credential.py | 7 +- .../get_deleted_automation_account.py | 39 + .../get_dsc_configuration.py | 7 +- .../get_dsc_configuration_content.py | 7 +- .../generated_samples/get_dsc_node.py | 7 +- .../get_dsc_node_configuration.py | 7 +- .../generated_samples/get_dsc_node_report.py | 7 +- .../get_dsc_node_report_content.py | 7 +- .../get_hybrid_runbook_worker.py | 44 + ....py => get_hybrid_runbook_worker_group.py} | 9 +- .../generated_samples/{job => }/get_job.py | 7 +- .../{job => }/get_job_output.py | 7 +- .../{job => }/get_job_runbook_content.py | 7 +- .../generated_samples/get_job_schedule.py | 7 +- .../{job => }/get_job_stream.py | 7 +- .../generated_samples/get_linked_workspace.py | 7 +- .../generated_samples/get_module.py | 7 +- ...{get_compilation_job.py => get_package.py} | 14 +- ...paged_dsc_configurations_with_no_filter.py | 7 +- ...edl_dsc_configurations_with_name_filter.py | 7 +- .../generated_samples/get_python2_package.py | 7 +- ..._stream_list.py => get_python3_package.py} | 13 +- .../generated_samples/get_runbook.py | 7 +- .../generated_samples/get_runbook_content.py | 7 +- .../generated_samples/get_runbook_draft.py | 7 +- .../get_runbook_draft_content.py | 7 +- .../get_runtime_environment.py | 43 + .../generated_samples/get_schedule.py | 7 +- ...t_software_update_configuration_by_name.py | 7 +- ..._update_configuration_machine_run_by_id.py | 7 +- ...software_update_configuration_run_by_id.py | 7 +- .../get_source_control.py | 7 +- .../get_source_control_sync_job.py | 7 +- .../get_source_control_sync_job_streams.py | 7 +- ...e_control_sync_job_streams_by_stream_id.py | 7 +- .../get_statistics_of_automation_account.py | 7 +- .../generated_samples/get_test_job.py | 7 +- .../generated_samples/get_test_job_stream.py | 7 +- .../get_usages_of_automation_account.py | 7 +- .../generated_samples/get_variable.py | 7 +- .../generated_samples/get_watcher.py | 7 +- .../generated_samples/get_webhook.py | 7 +- .../list_activities_by_module.py | 7 +- ...ist_all_dsc_nodes_by_automation_account.py | 7 +- ...all_job_schedules_by_automation_account.py | 7 +- ...ist_automation_account_deleted_runbooks.py | 43 + .../list_automation_account_keys.py | 7 +- ...t_automation_accounts_by_resource_group.py | 7 +- ...ist_automation_accounts_by_subscription.py | 7 +- ...list_certificates_by_automation_account.py | 7 +- ...nections_by_automation_account_first100.py | 7 +- ...nnections_by_automation_account_next100.py | 7 +- .../list_credentials_by_automation_account.py | 7 +- ...omation_account_next100_using_next_link.py | 7 +- .../list_dsc_node_configurations.py | 7 +- .../list_dsc_node_reports_by_node.py | 7 +- ...iled_software_update_configuration_runs.py | 7 +- .../list_fields_by_module_and_type.py | 9 +- .../generated_samples/list_fields_by_type.py | 7 +- .../list_hybrid_runbook_worker.py | 44 + ...py => list_hybrid_runbook_worker_group.py} | 11 +- .../{job => }/list_job_streams_by_job.py | 7 +- .../list_jobs_by_automation_account.py | 9 +- .../list_modules_by_automation_account.py | 7 +- ...> list_packages_by_runtime_environment.py} | 12 +- ...ist_paged_dsc_node_configuration_counts.py | 7 +- ...sc_node_configurations_with_name_filter.py | 7 +- ..._dsc_node_configurations_with_no_filter.py | 7 +- .../list_paged_dsc_node_reports_by_node.py | 44 + .../list_paged_dsc_node_status_counts.py | 7 +- ...utomation_account_with_composite_filter.py | 7 +- ..._by_automation_account_with_name_filter.py | 7 +- ...es_by_automation_account_with_no_filter.py | 7 +- ...t_with_node_configuration_custom_filter.py | 7 +- ..._node_configuration_not_assigned_filter.py | 7 +- ...y_automation_account_with_status_filter.py | 7 +- ..._automation_account_with_version_filter.py | 7 +- ..._python2_packages_by_automation_account.py | 7 +- ..._python3_packages_by_automation_account.py | 43 + .../list_rest_api_operations.py | 40 + .../list_runbooks_by_automation_account.py | 7 +- ...time_environments_by_automation_account.py | 43 + ...chedules_by_automation_account_first100.py | 7 +- ...schedules_by_automation_account_next100.py | 7 +- ...tware_update_configuration_machine_runs.py | 7 +- ...pdate_configuration_machine_runs_by_run.py | 6 +- ...list_software_update_configuration_runs.py | 7 +- .../list_software_update_configurations.py | 7 +- ...st_software_update_configurations_by_vm.py | 7 +- .../list_test_job_streams_by_job.py | 7 +- .../list_variables_first100.py | 7 +- .../list_variables_next100.py | 7 +- .../list_watchers_by_automation_account.py | 7 +- .../list_webhooks_by_automation_account.py | 7 +- .../move_hybrid_runbook_worker.py | 44 + ...ata_typeslist_fields_by_module_and_type.py | 45 + .../patch_hybrid_runbook_worker.py | 44 + .../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 | 7 +- .../put_hybrid_runbook_worker.py | 50 + .../put_hybrid_runbook_worker_group.py | 46 + .../regenerate_agent_registration_key.py | 7 +- .../replace_runbook_draft_content.py | 11 +- .../generated_samples/{job => }/resume_job.py | 7 +- .../generated_samples/resume_test_job.py | 7 +- .../serialize_graph_runbook_content.py | 43 + .../generated_samples/start_watcher.py | 7 +- .../generated_samples/{job => }/stop_job.py | 7 +- .../generated_samples/stop_test_job.py | 7 +- .../generated_samples/stop_watcher.py | 7 +- .../{job => }/suspend_job.py | 7 +- .../generated_samples/suspend_test_job.py | 7 +- ...raft_edit_to_last_known_published_state.py | 7 +- .../update_automation_account.py | 7 +- .../generated_samples/update_certificate.py | 7 +- .../generated_samples/update_connection.py | 7 +- .../update_credential_patch.py | 7 +- .../update_dsc_configuration.py | 7 +- .../generated_samples/update_dsc_node.py | 7 +- ... => update_hybrid_runbook_worker_group.py} | 13 +- .../generated_samples/update_module.py | 7 +- .../generated_samples/update_package.py | 55 + .../update_python2_package.py | 7 +- .../update_python3_package.py | 44 + .../generated_samples/update_runbook.py | 7 +- .../update_runtime_environment.py | 44 + .../generated_samples/update_schedule.py | 7 +- .../update_source_control_patch.py | 7 +- .../update_variable_patch.py | 7 +- .../generated_samples/update_watcher.py | 7 +- .../generated_samples/update_webhook.py | 7 +- .../generated_samples/webhook_generate_uri.py | 7 +- .../generated_tests/conftest.py | 2 +- .../generated_tests/test_automation.py | 3 +- .../test_automation_activity_operations.py | 4 +- ...st_automation_activity_operations_async.py | 4 +- ...ent_registration_information_operations.py | 4 +- ...gistration_information_operations_async.py | 4 +- .../generated_tests/test_automation_async.py | 3 +- ...utomation_automation_account_operations.py | 76 +- ...ion_automation_account_operations_async.py | 76 +- .../test_automation_certificate_operations.py | 36 +- ...automation_certificate_operations_async.py | 36 +- .../test_automation_connection_operations.py | 39 +- ..._automation_connection_operations_async.py | 39 +- ...t_automation_connection_type_operations.py | 30 +- ...mation_connection_type_operations_async.py | 30 +- .../test_automation_credential_operations.py | 27 +- ..._automation_credential_operations_async.py | 27 +- ..._deleted_automation_accounts_operations.py | 8 +- ...ed_automation_accounts_operations_async.py | 8 +- ...tomation_dsc_compilation_job_operations.py | 79 - ...on_dsc_compilation_job_operations_async.py | 82 - ...n_dsc_compilation_job_stream_operations.py | 32 - ...compilation_job_stream_operations_async.py | 33 - ...automation_dsc_configuration_operations.py | 56 +- ...tion_dsc_configuration_operations_async.py | 56 +- ...ation_dsc_node_configuration_operations.py | 46 +- ...dsc_node_configuration_operations_async.py | 46 +- .../test_automation_dsc_node_operations.py | 20 +- ...st_automation_dsc_node_operations_async.py | 20 +- .../test_automation_fields_operations.py | 3 +- ...test_automation_fields_operations_async.py | 3 +- ..._hybrid_runbook_worker_group_operations.py | 35 +- ...d_runbook_worker_group_operations_async.py | 35 +- ...ation_hybrid_runbook_workers_operations.py | 42 +- ...hybrid_runbook_workers_operations_async.py | 42 +- .../test_automation_job_operations.py | 46 +- .../test_automation_job_operations_async.py | 46 +- ...test_automation_job_schedule_operations.py | 32 +- ...utomation_job_schedule_operations_async.py | 32 +- .../test_automation_job_stream_operations.py | 4 +- ..._automation_job_stream_operations_async.py | 4 +- .../test_automation_keys_operations.py | 3 +- .../test_automation_keys_operations_async.py | 3 +- ..._automation_linked_workspace_operations.py | 3 +- ...ation_linked_workspace_operations_async.py | 3 +- .../test_automation_module_operations.py | 39 +- ...test_automation_module_operations_async.py | 39 +- ...ation_node_count_information_operations.py | 3 +- ...node_count_information_operations_async.py | 3 +- ...test_automation_node_reports_operations.py | 5 +- ...utomation_node_reports_operations_async.py | 5 +- ...automation_object_data_types_operations.py | 14 +- ...tion_object_data_types_operations_async.py | 14 +- .../test_automation_operations.py | 6 +- .../test_automation_operations_async.py | 6 +- .../test_automation_package_operations.py | 123 + ...est_automation_package_operations_async.py | 124 + ...private_endpoint_connections_operations.py | 54 +- ...e_endpoint_connections_operations_async.py | 56 +- ...ation_private_link_resources_operations.py | 5 +- ...private_link_resources_operations_async.py | 5 +- ...t_automation_python2_package_operations.py | 35 +- ...mation_python2_package_operations_async.py | 35 +- ...t_automation_python3_package_operations.py | 37 +- ...mation_python3_package_operations_async.py | 37 +- ...est_automation_runbook_draft_operations.py | 9 +- ...tomation_runbook_draft_operations_async.py | 9 +- .../test_automation_runbook_operations.py | 101 +- ...est_automation_runbook_operations_async.py | 105 +- ...omation_runtime_environments_operations.py | 109 + ...n_runtime_environments_operations_async.py | 110 + .../test_automation_schedule_operations.py | 51 +- ...st_automation_schedule_operations_async.py | 51 +- ...e_configuration_machine_runs_operations.py | 4 +- ...iguration_machine_runs_operations_async.py | 4 +- ...re_update_configuration_runs_operations.py | 4 +- ...ate_configuration_runs_operations_async.py | 4 +- ...ftware_update_configurations_operations.py | 144 +- ..._update_configurations_operations_async.py | 144 +- ...st_automation_source_control_operations.py | 59 +- ...omation_source_control_operations_async.py | 59 +- ...tion_source_control_sync_job_operations.py | 7 +- ...ource_control_sync_job_operations_async.py | 7 +- ...rce_control_sync_job_streams_operations.py | 4 +- ...ntrol_sync_job_streams_operations_async.py | 4 +- .../test_automation_statistics_operations.py | 3 +- ..._automation_statistics_operations_async.py | 3 +- .../test_automation_test_job_operations.py | 9 +- ...st_automation_test_job_operations_async.py | 9 +- ..._automation_test_job_streams_operations.py | 4 +- ...ation_test_job_streams_operations_async.py | 4 +- .../test_automation_usages_operations.py | 3 +- ...test_automation_usages_operations_async.py | 3 +- .../test_automation_variable_operations.py | 27 +- ...st_automation_variable_operations_async.py | 27 +- .../test_automation_watcher_operations.py | 77 +- ...est_automation_watcher_operations_async.py | 77 +- .../test_automation_webhook_operations.py | 49 +- ...est_automation_webhook_operations_async.py | 49 +- .../azure-mgmt-automation/pyproject.toml | 7 +- .../tests/test_mgmt_runbook_test.py | 1 + .../azure-mgmt-automation/tsp-location.yaml | 4 + 404 files changed, 65875 insertions(+), 49000 deletions(-) rename sdk/automation/azure-mgmt-automation/azure/mgmt/automation/{_automation_client.py => _client.py} (81%) create mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/model_base.py create mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/utils.py rename sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/{_automation_client.py => _client.py} (82%) delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_activity_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_agent_registration_information_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_account_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_certificate_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_type_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_credential_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_stream_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_configuration_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_configuration_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_fields_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_worker_group_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_schedule_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_stream_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_keys_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_linked_workspace_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_module_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_count_information_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_reports_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_object_data_types_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python2_package_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_draft_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_schedule_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_machine_runs_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_runs_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configurations_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_streams_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_statistics_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_streams_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_usages_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_variable_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_watcher_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_webhook_operations.py rename sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/{_automation_client_enums.py => _enums.py} (57%) create mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models_py3.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_activity_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_agent_registration_information_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_account_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_certificate_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_type_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_credential_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_stream_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_configuration_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_configuration_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_fields_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_worker_group_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_schedule_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_stream_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_keys_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_linked_workspace_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_module_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_count_information_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_reports_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_object_data_types_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python2_package_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_draft_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_schedule_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_machine_runs_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_runs_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configurations_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_streams_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_statistics_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_streams_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_usages_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_variable_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_watcher_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_webhook_operations.py rename sdk/automation/azure-mgmt-automation/generated_samples/{job => }/create_job.py (83%) rename sdk/automation/azure-mgmt-automation/generated_samples/{create_compilation_job.py => create_or_update_package.py} (60%) create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python3_package.py rename sdk/automation/azure-mgmt-automation/generated_samples/{source_control => }/create_or_update_source_control.py (85%) create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/create_runtime_environment.py rename sdk/automation/azure-mgmt-automation/generated_samples/{software_update_configuration => }/create_software_update_configuration.py (87%) rename sdk/automation/azure-mgmt-automation/generated_samples/{source_control_sync_job => }/create_source_control_sync_job.py (82%) create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/delete_package.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/delete_python3_package.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/delete_runtime_environment.py rename sdk/automation/azure-mgmt-automation/generated_samples/{software_update_configuration => }/delete_software_update_configuration.py (78%) rename sdk/automation/azure-mgmt-automation/generated_samples/{source_control => }/delete_source_control.py (81%) rename sdk/automation/azure-mgmt-automation/generated_samples/{compilation_job_stream_by_job_stream_id.py => deserialize_graph_runbook_content.py} (65%) rename sdk/automation/azure-mgmt-automation/generated_samples/{source_control_sync_job => }/get_all_source_control_sync_jobs.py (81%) rename sdk/automation/azure-mgmt-automation/generated_samples/{source_control => }/get_all_source_controls.py (81%) create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/get_deleted_automation_account.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py rename sdk/automation/azure-mgmt-automation/generated_samples/{hybrid_runbook_worker_group_get.py => get_hybrid_runbook_worker_group.py} (79%) rename sdk/automation/azure-mgmt-automation/generated_samples/{job => }/get_job.py (80%) rename sdk/automation/azure-mgmt-automation/generated_samples/{job => }/get_job_output.py (80%) rename sdk/automation/azure-mgmt-automation/generated_samples/{job => }/get_job_runbook_content.py (80%) rename sdk/automation/azure-mgmt-automation/generated_samples/{job => }/get_job_stream.py (81%) rename sdk/automation/azure-mgmt-automation/generated_samples/{get_compilation_job.py => get_package.py} (74%) rename sdk/automation/azure-mgmt-automation/generated_samples/{compilation_job_stream_list.py => get_python3_package.py} (73%) create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/get_runtime_environment.py rename sdk/automation/azure-mgmt-automation/generated_samples/{software_update_configuration => }/get_software_update_configuration_by_name.py (79%) rename sdk/automation/azure-mgmt-automation/generated_samples/{software_update_configuration_machine_run => }/get_software_update_configuration_machine_run_by_id.py (79%) rename sdk/automation/azure-mgmt-automation/generated_samples/{software_update_configuration_run => }/get_software_update_configuration_run_by_id.py (79%) rename sdk/automation/azure-mgmt-automation/generated_samples/{source_control => }/get_source_control.py (81%) rename sdk/automation/azure-mgmt-automation/generated_samples/{source_control_sync_job => }/get_source_control_sync_job.py (82%) rename sdk/automation/azure-mgmt-automation/generated_samples/{source_control_sync_job_streams => }/get_source_control_sync_job_streams.py (82%) rename sdk/automation/azure-mgmt-automation/generated_samples/{source_control_sync_job_streams => }/get_source_control_sync_job_streams_by_stream_id.py (82%) create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_deleted_runbooks.py rename sdk/automation/azure-mgmt-automation/generated_samples/{software_update_configuration_run => }/list_failed_software_update_configuration_runs.py (78%) create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker.py rename sdk/automation/azure-mgmt-automation/generated_samples/{hybrid_runbook_worker_group_list.py => list_hybrid_runbook_worker_group.py} (77%) rename sdk/automation/azure-mgmt-automation/generated_samples/{job => }/list_job_streams_by_job.py (80%) rename sdk/automation/azure-mgmt-automation/generated_samples/{job => }/list_jobs_by_automation_account.py (76%) rename sdk/automation/azure-mgmt-automation/generated_samples/{list_compilation_jobs_by_automation_account.py => list_packages_by_runtime_environment.py} (74%) create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_reports_by_node.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/list_python3_packages_by_automation_account.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/list_rest_api_operations.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/list_runtime_environments_by_automation_account.py rename sdk/automation/azure-mgmt-automation/generated_samples/{software_update_configuration_machine_run => }/list_software_update_configuration_machine_runs.py (78%) rename sdk/automation/azure-mgmt-automation/generated_samples/{software_update_configuration_machine_run => }/list_software_update_configuration_machine_runs_by_run.py (80%) rename sdk/automation/azure-mgmt-automation/generated_samples/{software_update_configuration_run => }/list_software_update_configuration_runs.py (78%) rename sdk/automation/azure-mgmt-automation/generated_samples/{software_update_configuration => }/list_software_update_configurations.py (78%) rename sdk/automation/azure-mgmt-automation/generated_samples/{software_update_configuration => }/list_software_update_configurations_by_vm.py (78%) create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/move_hybrid_runbook_worker.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/object_data_typeslist_fields_by_module_and_type.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/patch_hybrid_runbook_worker.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_delete.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_get.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_list_get.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_update.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/private_link_resource_list_get.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker_group.py rename sdk/automation/azure-mgmt-automation/generated_samples/{job => }/resume_job.py (80%) create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/serialize_graph_runbook_content.py rename sdk/automation/azure-mgmt-automation/generated_samples/{job => }/stop_job.py (80%) rename sdk/automation/azure-mgmt-automation/generated_samples/{job => }/suspend_job.py (80%) rename sdk/automation/azure-mgmt-automation/generated_samples/{hybrid_runbook_worker_group_update.py => update_hybrid_runbook_worker_group.py} (76%) create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/update_package.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/update_python3_package.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/update_runtime_environment.py rename sdk/automation/azure-mgmt-automation/generated_samples/{source_control => }/update_source_control_patch.py (84%) delete mode 100644 sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_operations_async.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_stream_operations.py delete mode 100644 sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_stream_operations_async.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_tests/test_automation_package_operations.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_tests/test_automation_package_operations_async.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runtime_environments_operations.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runtime_environments_operations_async.py create mode 100644 sdk/automation/azure-mgmt-automation/tsp-location.yaml diff --git a/sdk/automation/azure-mgmt-automation/CHANGELOG.md b/sdk/automation/azure-mgmt-automation/CHANGELOG.md index 6a72e91b8dc3..12cba94cf282 100644 --- a/sdk/automation/azure-mgmt-automation/CHANGELOG.md +++ b/sdk/automation/azure-mgmt-automation/CHANGELOG.md @@ -1,5 +1,294 @@ # Release History +## 1.1.0b5 (2026-05-27) + +### Features Added + + - Client `AutomationClient` added parameter `cloud_setting` in method `__init__` + - Client `AutomationClient` added method `send_request` + - Client `AutomationClient` added operation group `runtime_environments` + - Client `AutomationClient` added operation group `package` + - Model `AgentRegistration` added property `keys_property` + - Model `AutomationAccountCreateOrUpdateParameters` added property `properties` + - Model `AutomationAccountUpdateParameters` added property `properties` + - Model `Certificate` added property `system_data` + - Model `CertificateCreateOrUpdateParameters` added property `properties` + - Model `CertificateUpdateParameters` added property `properties` + - Model `Connection` added property `system_data` + - Model `ConnectionCreateOrUpdateParameters` added property `properties` + - Model `ConnectionType` added property `system_data` + - Model `ConnectionTypeCreateOrUpdateParameters` added property `properties` + - Model `ConnectionUpdateParameters` added property `properties` + - Model `Credential` added property `system_data` + - Model `CredentialCreateOrUpdateParameters` added property `properties` + - Model `CredentialUpdateParameters` added property `properties` + - Model `DscConfiguration` added property `system_data` + - Model `DscConfigurationCreateOrUpdateParameters` added property `properties` + - Model `DscConfigurationUpdateParameters` added property `properties` + - Model `DscNode` added property `system_data` + - Model `DscNodeConfiguration` added property `system_data` + - Model `HybridRunbookWorker` added property `tags` + - Model `HybridRunbookWorker` added property `location` + - Model `HybridRunbookWorkerCreateParameters` added property `properties` + - Model `HybridRunbookWorkerGroup` added property `tags` + - Model `HybridRunbookWorkerGroup` added property `location` + - Model `HybridRunbookWorkerGroupCreateOrUpdateParameters` added property `properties` + - Model `Job` added property `system_data` + - Model `JobCollectionItem` added property `system_data` + - Model `JobSchedule` added property `system_data` + - Model `Module` added property `system_data` + - Model `ModuleCreateOrUpdateParameters` added property `properties` + - Enum `ModuleProvisioningState` added member `CANCELED` + - Model `ModuleUpdateParameters` added property `properties` + - Model `Operation` added property `properties` + - Model `PrivateEndpointConnection` added property `system_data` + - Model `PrivateLinkResource` added property `system_data` + - Model `ProxyResource` added property `system_data` + - Model `PythonPackageCreateParameters` added property `properties` + - Model `Resource` added property `system_data` + - Model `Runbook` added property `system_data` + - Model `RunbookCreateOrUpdateParameters` added property `properties` + - Enum `RunbookTypeEnum` added member `POWER_SHELL72` + - Enum `RunbookTypeEnum` added member `PYTHON` + - Model `RunbookUpdateParameters` added property `properties` + - Model `Schedule` added property `system_data` + - Model `ScheduleCreateOrUpdateParameters` added property `properties` + - Model `ScheduleUpdateParameters` added property `properties` + - Model `SoftwareUpdateConfiguration` added property `system_data` + - Model `SoftwareUpdateConfigurationMachineRun` added property `properties` + - Model `SourceControl` added property `system_data` + - Model `TestJobCreateParameters` added property `runtime_environment` + - Model `TrackedResource` added property `system_data` + - Model `Variable` added property `system_data` + - Model `VariableCreateOrUpdateParameters` added property `properties` + - Model `VariableUpdateParameters` added property `properties` + - Model `Watcher` added property `system_data` + - Model `WatcherUpdateParameters` added property `properties` + - Model `Webhook` added property `system_data` + - Model `WebhookCreateOrUpdateParameters` added property `properties` + - Model `WebhookUpdateParameters` added property `properties` + - Added model `AutomationAccountCreateOrUpdateProperties` + - Added model `AutomationAccountUpdateProperties` + - Added model `AutomationErrorResponse` + - Added model `CertificateCreateOrUpdateProperties` + - Added model `CertificateUpdateProperties` + - Added model `ConnectionCreateOrUpdateProperties` + - Added model `ConnectionTypeCreateOrUpdateProperties` + - Added model `ConnectionUpdateProperties` + - Added model `CredentialCreateOrUpdateProperties` + - Added model `CredentialUpdateProperties` + - Added model `DeletedRunbook` + - Added model `DeletedRunbookProperties` + - Added model `DscConfigurationCreateOrUpdateProperties` + - Added model `DscNodeConfigurationAssociationProperty` + - Added model `ErrorAdditionalInfo` + - Added model `ErrorDetail` + - Added model `HybridRunbookWorkerCreateOrUpdateParameters` + - Added model `HybridRunbookWorkerGroupCreateOrUpdateProperties` + - Added model `JobCreateProperties` + - Added model `JobRuntimeEnvironment` + - Added model `JobScheduleCreateProperties` + - Added model `ModuleCreateOrUpdateProperties` + - Added model `ModuleUpdateProperties` + - Added model `OperationPropertiesFormat` + - Added model `Package` + - Added model `PackageCreateOrUpdateParameters` + - Added model `PackageCreateOrUpdateProperties` + - Added model `PackageErrorInfo` + - Added model `PackageProperties` + - Added enum `PackageProvisioningState` + - Added model `PackageUpdateParameters` + - Added model `PackageUpdateProperties` + - Added model `PythonPackageCreateProperties` + - Added model `RunbookCreateOrUpdateProperties` + - Added model `RunbookUpdateProperties` + - Added model `RuntimeEnvironment` + - Added model `RuntimeEnvironmentProperties` + - Added model `RuntimeEnvironmentUpdateParameters` + - Added model `RuntimeEnvironmentUpdateProperties` + - Added model `RuntimeProperties` + - Added model `ScheduleCreateOrUpdateProperties` + - Added model `ScheduleUpdateProperties` + - Added model `SourceControlCreateOrUpdateProperties` + - Added model `SourceControlSyncJobCreateProperties` + - Added model `SourceControlUpdateProperties` + - Added model `UpdateConfigurationMachineRunProperties` + - Added model `VariableCreateOrUpdateProperties` + - Added model `VariableUpdateProperties` + - Added model `WatcherUpdateProperties` + - Added model `WebhookCreateOrUpdateProperties` + - Added model `WebhookUpdateProperties` + - Model `AutomationAccountOperations` added method `list_deleted_runbooks` + - Model `HybridRunbookWorkersOperations` added method `patch` + - Added model `PackageOperations` + - Added model `RuntimeEnvironmentsOperations` + +### Breaking Changes + + - Deleted or renamed client operation group `AutomationClient.dsc_compilation_job` + - Deleted or renamed client operation group `AutomationClient.dsc_compilation_job_stream` + - Model `AgentRegistration` deleted or renamed its instance variable `keys` + - Model `AutomationAccountCreateOrUpdateParameters` deleted or renamed its instance variable `sku` + - Model `AutomationAccountCreateOrUpdateParameters` deleted or renamed its instance variable `encryption` + - Model `AutomationAccountCreateOrUpdateParameters` deleted or renamed its instance variable `public_network_access` + - Model `AutomationAccountCreateOrUpdateParameters` deleted or renamed its instance variable `disable_local_auth` + - Model `AutomationAccountUpdateParameters` deleted or renamed its instance variable `sku` + - Model `AutomationAccountUpdateParameters` deleted or renamed its instance variable `encryption` + - Model `AutomationAccountUpdateParameters` deleted or renamed its instance variable `public_network_access` + - Model `AutomationAccountUpdateParameters` deleted or renamed its instance variable `disable_local_auth` + - Model `CertificateCreateOrUpdateParameters` deleted or renamed its instance variable `base64_value` + - Model `CertificateCreateOrUpdateParameters` deleted or renamed its instance variable `description` + - Model `CertificateCreateOrUpdateParameters` deleted or renamed its instance variable `thumbprint` + - Model `CertificateCreateOrUpdateParameters` deleted or renamed its instance variable `is_exportable` + - Model `CertificateUpdateParameters` deleted or renamed its instance variable `description` + - Model `ConnectionCreateOrUpdateParameters` deleted or renamed its instance variable `description` + - Model `ConnectionCreateOrUpdateParameters` deleted or renamed its instance variable `connection_type` + - Model `ConnectionCreateOrUpdateParameters` deleted or renamed its instance variable `field_definition_values` + - Model `ConnectionTypeCreateOrUpdateParameters` deleted or renamed its instance variable `is_global` + - Model `ConnectionTypeCreateOrUpdateParameters` deleted or renamed its instance variable `field_definitions` + - Model `ConnectionUpdateParameters` deleted or renamed its instance variable `description` + - Model `ConnectionUpdateParameters` deleted or renamed its instance variable `field_definition_values` + - Model `CredentialCreateOrUpdateParameters` deleted or renamed its instance variable `user_name` + - Model `CredentialCreateOrUpdateParameters` deleted or renamed its instance variable `password` + - Model `CredentialCreateOrUpdateParameters` deleted or renamed its instance variable `description` + - Model `CredentialUpdateParameters` deleted or renamed its instance variable `user_name` + - Model `CredentialUpdateParameters` deleted or renamed its instance variable `password` + - Model `CredentialUpdateParameters` deleted or renamed its instance variable `description` + - Model `DscConfigurationCreateOrUpdateParameters` deleted or renamed its instance variable `log_verbose` + - Model `DscConfigurationCreateOrUpdateParameters` deleted or renamed its instance variable `log_progress` + - Model `DscConfigurationCreateOrUpdateParameters` deleted or renamed its instance variable `source` + - Model `DscConfigurationCreateOrUpdateParameters` deleted or renamed its instance variable `parameters` + - Model `DscConfigurationCreateOrUpdateParameters` deleted or renamed its instance variable `description` + - Model `DscConfigurationUpdateParameters` deleted or renamed its instance variable `log_verbose` + - Model `DscConfigurationUpdateParameters` deleted or renamed its instance variable `log_progress` + - Model `DscConfigurationUpdateParameters` deleted or renamed its instance variable `source` + - Model `DscConfigurationUpdateParameters` deleted or renamed its instance variable `parameters` + - Model `DscConfigurationUpdateParameters` deleted or renamed its instance variable `description` + - Model `DscNodeUpdateParametersProperties` deleted or renamed its instance variable `name` + - Model `ErrorResponse` deleted or renamed its instance variable `code` + - Model `ErrorResponse` deleted or renamed its instance variable `message` + - Model `HybridRunbookWorkerCreateParameters` deleted or renamed its instance variable `vm_resource_id` + - Model `HybridRunbookWorkerGroupCreateOrUpdateParameters` deleted or renamed its instance variable `credential` + - Model `JobCreateParameters` deleted or renamed its instance variable `runbook` + - Model `JobCreateParameters` deleted or renamed its instance variable `parameters` + - Model `JobCreateParameters` deleted or renamed its instance variable `run_on` + - Model `JobScheduleCreateParameters` deleted or renamed its instance variable `schedule` + - Model `JobScheduleCreateParameters` deleted or renamed its instance variable `runbook` + - Model `JobScheduleCreateParameters` deleted or renamed its instance variable `run_on` + - Model `JobScheduleCreateParameters` deleted or renamed its instance variable `parameters` + - Model `KeyListResult` deleted or renamed its instance variable `keys` + - Model `ModuleCreateOrUpdateParameters` deleted or renamed its instance variable `content_link` + - Deleted or renamed enum value `ModuleProvisioningState.CANCELLED` + - Model `ModuleUpdateParameters` deleted or renamed its instance variable `content_link` + - Model `Operation` deleted or renamed its instance variable `service_specification` + - Model `PythonPackageCreateParameters` deleted or renamed its instance variable `content_link` + - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `log_verbose` + - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `log_progress` + - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `runbook_type` + - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `draft` + - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `publish_content_link` + - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `description` + - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `log_activity_trace` + - Model `RunbookUpdateParameters` deleted or renamed its instance variable `description` + - Model `RunbookUpdateParameters` deleted or renamed its instance variable `log_verbose` + - Model `RunbookUpdateParameters` deleted or renamed its instance variable `log_progress` + - Model `RunbookUpdateParameters` deleted or renamed its instance variable `log_activity_trace` + - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `description` + - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `start_time` + - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `expiry_time` + - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `interval` + - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `frequency` + - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `time_zone` + - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `advanced_schedule` + - Model `ScheduleUpdateParameters` deleted or renamed its instance variable `description` + - Model `ScheduleUpdateParameters` deleted or renamed its instance variable `is_enabled` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `target_computer` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `target_computer_type` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `software_update_configuration` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `status` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `os_type` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `correlation_id` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `source_computer_id` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `start_time` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `end_time` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `configured_duration` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `job` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `creation_time` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `created_by` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `last_modified_time` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `last_modified_by` + - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `error` + - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `repo_url` + - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `branch` + - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `folder_path` + - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `auto_sync` + - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `publish_runbook` + - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `source_type` + - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `security_token` + - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `description` + - Model `SourceControlSyncJobCreateParameters` deleted or renamed its instance variable `commit_id` + - Model `SourceControlUpdateParameters` deleted or renamed its instance variable `branch` + - Model `SourceControlUpdateParameters` deleted or renamed its instance variable `folder_path` + - Model `SourceControlUpdateParameters` deleted or renamed its instance variable `auto_sync` + - Model `SourceControlUpdateParameters` deleted or renamed its instance variable `publish_runbook` + - Model `SourceControlUpdateParameters` deleted or renamed its instance variable `security_token` + - Model `SourceControlUpdateParameters` deleted or renamed its instance variable `description` + - Model `VariableCreateOrUpdateParameters` deleted or renamed its instance variable `value` + - Model `VariableCreateOrUpdateParameters` deleted or renamed its instance variable `description` + - Model `VariableCreateOrUpdateParameters` deleted or renamed its instance variable `is_encrypted` + - Model `VariableUpdateParameters` deleted or renamed its instance variable `value` + - Model `VariableUpdateParameters` deleted or renamed its instance variable `description` + - Model `WatcherUpdateParameters` deleted or renamed its instance variable `execution_frequency_in_seconds` + - Model `WebhookCreateOrUpdateParameters` deleted or renamed its instance variable `is_enabled` + - Model `WebhookCreateOrUpdateParameters` deleted or renamed its instance variable `uri` + - Model `WebhookCreateOrUpdateParameters` deleted or renamed its instance variable `expiry_time` + - Model `WebhookCreateOrUpdateParameters` deleted or renamed its instance variable `parameters` + - Model `WebhookCreateOrUpdateParameters` deleted or renamed its instance variable `runbook` + - Model `WebhookCreateOrUpdateParameters` deleted or renamed its instance variable `run_on` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `is_enabled` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `run_on` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `parameters` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `description` + - Deleted or renamed model `DscCompilationJob` + - Deleted or renamed model `DscCompilationJobCreateParameters` + - Deleted or renamed model `JobListResultV2` + - Deleted or renamed model `RunbookCreateOrUpdateDraftParameters` + - Deleted or renamed model `RunbookCreateOrUpdateDraftProperties` + - Deleted or renamed model `SourceControlSyncJobStreamsListBySyncJob` + - Method `DscConfigurationOperations.list_by_automation_account` changed its parameter `inlinecount` from `positional_or_keyword` to `keyword_only` + - Method `DscNodeConfigurationOperations.list_by_automation_account` changed its parameter `inlinecount` from `positional_or_keyword` to `keyword_only` + - Method `DscNodeOperations.list_by_automation_account` changed its parameter `inlinecount` from `positional_or_keyword` to `keyword_only` + - Method `JobOperations.create` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `JobOperations.get` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `JobOperations.get_output` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `JobOperations.get_runbook_content` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `JobOperations.list_by_automation_account` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `JobOperations.resume` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `JobOperations.stop` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `JobOperations.suspend` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `JobStreamOperations.get` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `JobStreamOperations.list_by_job` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `SoftwareUpdateConfigurationMachineRunsOperations.get_by_id` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `SoftwareUpdateConfigurationMachineRunsOperations.list` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `SoftwareUpdateConfigurationRunsOperations.get_by_id` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `SoftwareUpdateConfigurationRunsOperations.list` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `SoftwareUpdateConfigurationsOperations.create` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `SoftwareUpdateConfigurationsOperations.delete` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `SoftwareUpdateConfigurationsOperations.get_by_name` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Method `SoftwareUpdateConfigurationsOperations.list` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` + - Deleted or renamed model `AutomationClientOperationsMixin` + - Deleted or renamed model `DscCompilationJobOperations` + - Deleted or renamed model `DscCompilationJobStreamOperations` + - Method `DscConfigurationOperations.get_content` changed return type from `AsyncIterator[bytes]` to `str` + - Method `RunbookDraftOperations.begin_replace_content` changed return type from `AsyncLROPoller[AsyncIterator[bytes]]` to `AsyncLROPoller[None]` + - Method `RunbookDraftOperations.get_content` changed return type from `AsyncIterator[bytes]` to `str` + - Method `RunbookOperations.get_content` changed return type from `AsyncIterator[bytes]` to `str` + - Method `DscConfigurationOperations.get_content` changed return type from `Iterator[bytes]` to `str` + - Method `NodeReportsOperations.get_content` changed return type from `JSON` to `str` + - Method `RunbookDraftOperations.begin_replace_content` changed return type from `LROPoller[Iterator[bytes]]` to `LROPoller[None]` + - Method `RunbookDraftOperations.get_content` changed return type from `Iterator[bytes]` to `str` + - Method `RunbookOperations.get_content` changed return type from `Iterator[bytes]` to `str` + ## 1.0.1 (2026-05-14) ### Other Changes diff --git a/sdk/automation/azure-mgmt-automation/_metadata.json b/sdk/automation/azure-mgmt-automation/_metadata.json index 58000c38ae2c..b5f6d1ac6409 100644 --- a/sdk/automation/azure-mgmt-automation/_metadata.json +++ b/sdk/automation/azure-mgmt-automation/_metadata.json @@ -1,11 +1,10 @@ { - "commit": "85a5e103401c5c039f7071e7d5df47cee124443f", + "apiVersion": "2024-10-23", + "apiVersions": { + "Microsoft.Automation": "2024-10-23" + }, + "commit": "da8db6e593df9f3ddc13139c39930fdad54d12f7", "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" + "typespec_src": "specification/automation/Automation.Management", + "emitterVersion": "0.62.1" } \ 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 index d70fee36f6c4..5a35f991467e 100644 --- a/sdk/automation/azure-mgmt-automation/apiview-properties.json +++ b/sdk/automation/azure-mgmt-automation/apiview-properties.json @@ -1,488 +1,615 @@ { - "CrossLanguagePackageId": null, + "CrossLanguagePackageId": "Microsoft.Automation", "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 - } + "azure.mgmt.automation.models.Activity": "Microsoft.Automation.Activity", + "azure.mgmt.automation.models.ActivityOutputType": "Microsoft.Automation.ActivityOutputType", + "azure.mgmt.automation.models.ActivityParameter": "Microsoft.Automation.ActivityParameter", + "azure.mgmt.automation.models.ActivityParameterSet": "Microsoft.Automation.ActivityParameterSet", + "azure.mgmt.automation.models.ActivityParameterValidationSet": "Microsoft.Automation.ActivityParameterValidationSet", + "azure.mgmt.automation.models.ActivityProperties": "Microsoft.Automation.ActivityProperties", + "azure.mgmt.automation.models.AdvancedSchedule": "Microsoft.Automation.AdvancedSchedule", + "azure.mgmt.automation.models.AdvancedScheduleMonthlyOccurrence": "Microsoft.Automation.AdvancedScheduleMonthlyOccurrence", + "azure.mgmt.automation.models.AgentRegistration": "Microsoft.Automation.AgentRegistration", + "azure.mgmt.automation.models.AgentRegistrationKeys": "Microsoft.Automation.AgentRegistrationKeys", + "azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter": "Microsoft.Automation.AgentRegistrationRegenerateKeyParameter", + "azure.mgmt.automation.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.automation.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.automation.models.AutomationAccount": "Microsoft.Automation.AutomationAccount", + "azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters": "Microsoft.Automation.AutomationAccountCreateOrUpdateParameters", + "azure.mgmt.automation.models.AutomationAccountCreateOrUpdateProperties": "Microsoft.Automation.AutomationAccountCreateOrUpdateProperties", + "azure.mgmt.automation.models.AutomationAccountProperties": "Microsoft.Automation.AutomationAccountProperties", + "azure.mgmt.automation.models.AutomationAccountUpdateParameters": "Microsoft.Automation.AutomationAccountUpdateParameters", + "azure.mgmt.automation.models.AutomationAccountUpdateProperties": "Microsoft.Automation.AutomationAccountUpdateProperties", + "azure.mgmt.automation.models.AutomationErrorResponse": "Microsoft.Automation.AutomationErrorResponse", + "azure.mgmt.automation.models.AzureQueryProperties": "Microsoft.Automation.AzureQueryProperties", + "azure.mgmt.automation.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.automation.models.Certificate": "Microsoft.Automation.Certificate", + "azure.mgmt.automation.models.CertificateCreateOrUpdateParameters": "Microsoft.Automation.CertificateCreateOrUpdateParameters", + "azure.mgmt.automation.models.CertificateCreateOrUpdateProperties": "Microsoft.Automation.CertificateCreateOrUpdateProperties", + "azure.mgmt.automation.models.CertificateProperties": "Microsoft.Automation.CertificateProperties", + "azure.mgmt.automation.models.CertificateUpdateParameters": "Microsoft.Automation.CertificateUpdateParameters", + "azure.mgmt.automation.models.CertificateUpdateProperties": "Microsoft.Automation.CertificateUpdateProperties", + "azure.mgmt.automation.models.Connection": "Microsoft.Automation.Connection", + "azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters": "Microsoft.Automation.ConnectionCreateOrUpdateParameters", + "azure.mgmt.automation.models.ConnectionCreateOrUpdateProperties": "Microsoft.Automation.ConnectionCreateOrUpdateProperties", + "azure.mgmt.automation.models.ConnectionProperties": "Microsoft.Automation.ConnectionProperties", + "azure.mgmt.automation.models.ConnectionType": "Microsoft.Automation.ConnectionType", + "azure.mgmt.automation.models.ConnectionTypeAssociationProperty": "Microsoft.Automation.ConnectionTypeAssociationProperty", + "azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters": "Microsoft.Automation.ConnectionTypeCreateOrUpdateParameters", + "azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateProperties": "Microsoft.Automation.ConnectionTypeCreateOrUpdateProperties", + "azure.mgmt.automation.models.ConnectionTypeProperties": "Microsoft.Automation.ConnectionTypeProperties", + "azure.mgmt.automation.models.ConnectionUpdateParameters": "Microsoft.Automation.ConnectionUpdateParameters", + "azure.mgmt.automation.models.ConnectionUpdateProperties": "Microsoft.Automation.ConnectionUpdateProperties", + "azure.mgmt.automation.models.ContentHash": "Microsoft.Automation.ContentHash", + "azure.mgmt.automation.models.ContentLink": "Microsoft.Automation.ContentLink", + "azure.mgmt.automation.models.ContentSource": "Microsoft.Automation.ContentSource", + "azure.mgmt.automation.models.Credential": "Microsoft.Automation.Credential", + "azure.mgmt.automation.models.CredentialCreateOrUpdateParameters": "Microsoft.Automation.CredentialCreateOrUpdateParameters", + "azure.mgmt.automation.models.CredentialCreateOrUpdateProperties": "Microsoft.Automation.CredentialCreateOrUpdateProperties", + "azure.mgmt.automation.models.CredentialProperties": "Microsoft.Automation.CredentialProperties", + "azure.mgmt.automation.models.CredentialUpdateParameters": "Microsoft.Automation.CredentialUpdateParameters", + "azure.mgmt.automation.models.CredentialUpdateProperties": "Microsoft.Automation.CredentialUpdateProperties", + "azure.mgmt.automation.models.DeletedAutomationAccount": "Microsoft.Automation.DeletedAutomationAccount", + "azure.mgmt.automation.models.DeletedAutomationAccountListResult": "Microsoft.Automation.DeletedAutomationAccountListResult", + "azure.mgmt.automation.models.DeletedAutomationAccountProperties": "Microsoft.Automation.DeletedAutomationAccountProperties", + "azure.mgmt.automation.models.DeletedRunbook": "Microsoft.Automation.DeletedRunbook", + "azure.mgmt.automation.models.DeletedRunbookProperties": "Microsoft.Automation.DeletedRunbookProperties", + "azure.mgmt.automation.models.Dimension": "Microsoft.Automation.Dimension", + "azure.mgmt.automation.models.DscConfiguration": "Microsoft.Automation.DscConfiguration", + "azure.mgmt.automation.models.DscConfigurationAssociationProperty": "Microsoft.Automation.DscConfigurationAssociationProperty", + "azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters": "Microsoft.Automation.DscConfigurationCreateOrUpdateParameters", + "azure.mgmt.automation.models.DscConfigurationCreateOrUpdateProperties": "Microsoft.Automation.DscConfigurationCreateOrUpdateProperties", + "azure.mgmt.automation.models.DscConfigurationParameter": "Microsoft.Automation.DscConfigurationParameter", + "azure.mgmt.automation.models.DscConfigurationProperties": "Microsoft.Automation.DscConfigurationProperties", + "azure.mgmt.automation.models.DscConfigurationUpdateParameters": "Microsoft.Automation.DscConfigurationUpdateParameters", + "azure.mgmt.automation.models.DscMetaConfiguration": "Microsoft.Automation.DscMetaConfiguration", + "azure.mgmt.automation.models.DscNode": "Microsoft.Automation.DscNode", + "azure.mgmt.automation.models.DscNodeConfiguration": "Microsoft.Automation.DscNodeConfiguration", + "azure.mgmt.automation.models.DscNodeConfigurationAssociationProperty": "Microsoft.Automation.DscNodeConfigurationAssociationProperty", + "azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters": "Microsoft.Automation.DscNodeConfigurationCreateOrUpdateParameters", + "azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParametersProperties": "Microsoft.Automation.DscNodeConfigurationCreateOrUpdateParametersProperties", + "azure.mgmt.automation.models.DscNodeConfigurationProperties": "Microsoft.Automation.DscNodeConfigurationProperties", + "azure.mgmt.automation.models.DscNodeExtensionHandlerAssociationProperty": "Microsoft.Automation.DscNodeExtensionHandlerAssociationProperty", + "azure.mgmt.automation.models.DscNodeProperties": "Microsoft.Automation.DscNodeProperties", + "azure.mgmt.automation.models.DscNodeReport": "Microsoft.Automation.DscNodeReport", + "azure.mgmt.automation.models.DscNodeUpdateParameters": "Microsoft.Automation.DscNodeUpdateParameters", + "azure.mgmt.automation.models.DscNodeUpdateParametersProperties": "Microsoft.Automation.DscNodeUpdateParametersProperties", + "azure.mgmt.automation.models.DscReportError": "Microsoft.Automation.DscReportError", + "azure.mgmt.automation.models.DscReportResource": "Microsoft.Automation.DscReportResource", + "azure.mgmt.automation.models.DscReportResourceNavigation": "Microsoft.Automation.DscReportResourceNavigation", + "azure.mgmt.automation.models.EncryptionProperties": "Microsoft.Automation.EncryptionProperties", + "azure.mgmt.automation.models.EncryptionPropertiesIdentity": "Microsoft.Automation.EncryptionPropertiesIdentity", + "azure.mgmt.automation.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.automation.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.automation.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.automation.models.FieldDefinition": "Microsoft.Automation.FieldDefinition", + "azure.mgmt.automation.models.GraphicalRunbookContent": "Microsoft.Automation.GraphicalRunbookContent", + "azure.mgmt.automation.models.HybridRunbookWorker": "Microsoft.Automation.HybridRunbookWorker", + "azure.mgmt.automation.models.HybridRunbookWorkerCreateOrUpdateParameters": "Microsoft.Automation.HybridRunbookWorkerCreateOrUpdateParameters", + "azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters": "Microsoft.Automation.HybridRunbookWorkerCreateParameters", + "azure.mgmt.automation.models.HybridRunbookWorkerGroup": "Microsoft.Automation.HybridRunbookWorkerGroup", + "azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters": "Microsoft.Automation.HybridRunbookWorkerGroupCreateOrUpdateParameters", + "azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateProperties": "Microsoft.Automation.HybridRunbookWorkerGroupCreateOrUpdateProperties", + "azure.mgmt.automation.models.HybridRunbookWorkerGroupProperties": "Microsoft.Automation.HybridRunbookWorkerGroupProperties", + "azure.mgmt.automation.models.HybridRunbookWorkerMoveParameters": "Microsoft.Automation.HybridRunbookWorkerMoveParameters", + "azure.mgmt.automation.models.HybridRunbookWorkerProperties": "Microsoft.Automation.HybridRunbookWorkerProperties", + "azure.mgmt.automation.models.Identity": "Microsoft.Automation.Identity", + "azure.mgmt.automation.models.Job": "Microsoft.Automation.Job", + "azure.mgmt.automation.models.JobCollectionItem": "Microsoft.Automation.JobCollectionItem", + "azure.mgmt.automation.models.JobCollectionItemProperties": "Microsoft.Automation.JobCollectionItemProperties", + "azure.mgmt.automation.models.JobCreateParameters": "Microsoft.Automation.JobCreateParameters", + "azure.mgmt.automation.models.JobCreateProperties": "Microsoft.Automation.JobCreateProperties", + "azure.mgmt.automation.models.JobNavigation": "Microsoft.Automation.jobNavigation", + "azure.mgmt.automation.models.JobProperties": "Microsoft.Automation.JobProperties", + "azure.mgmt.automation.models.JobRuntimeEnvironment": "Microsoft.Automation.JobRuntimeEnvironment", + "azure.mgmt.automation.models.JobSchedule": "Microsoft.Automation.JobSchedule", + "azure.mgmt.automation.models.JobScheduleCreateParameters": "Microsoft.Automation.JobScheduleCreateParameters", + "azure.mgmt.automation.models.JobScheduleCreateProperties": "Microsoft.Automation.JobScheduleCreateProperties", + "azure.mgmt.automation.models.JobScheduleProperties": "Microsoft.Automation.JobScheduleProperties", + "azure.mgmt.automation.models.JobStream": "Microsoft.Automation.JobStream", + "azure.mgmt.automation.models.JobStreamProperties": "Microsoft.Automation.JobStreamProperties", + "azure.mgmt.automation.models.Key": "Microsoft.Automation.Key", + "azure.mgmt.automation.models.KeyListResult": "Microsoft.Automation.KeyListResult", + "azure.mgmt.automation.models.KeyVaultProperties": "Microsoft.Automation.KeyVaultProperties", + "azure.mgmt.automation.models.LinkedWorkspace": "Microsoft.Automation.LinkedWorkspace", + "azure.mgmt.automation.models.LinuxProperties": "Microsoft.Automation.LinuxProperties", + "azure.mgmt.automation.models.LogSpecification": "Microsoft.Automation.LogSpecification", + "azure.mgmt.automation.models.MetricSpecification": "Microsoft.Automation.MetricSpecification", + "azure.mgmt.automation.models.Module": "Microsoft.Automation.Module", + "azure.mgmt.automation.models.ModuleCreateOrUpdateParameters": "Microsoft.Automation.ModuleCreateOrUpdateParameters", + "azure.mgmt.automation.models.ModuleCreateOrUpdateProperties": "Microsoft.Automation.ModuleCreateOrUpdateProperties", + "azure.mgmt.automation.models.ModuleErrorInfo": "Microsoft.Automation.ModuleErrorInfo", + "azure.mgmt.automation.models.ModuleProperties": "Microsoft.Automation.ModuleProperties", + "azure.mgmt.automation.models.ModuleUpdateParameters": "Microsoft.Automation.ModuleUpdateParameters", + "azure.mgmt.automation.models.ModuleUpdateProperties": "Microsoft.Automation.ModuleUpdateProperties", + "azure.mgmt.automation.models.NodeCount": "Microsoft.Automation.NodeCount", + "azure.mgmt.automation.models.NodeCountProperties": "Microsoft.Automation.NodeCountProperties", + "azure.mgmt.automation.models.NodeCounts": "Microsoft.Automation.NodeCounts", + "azure.mgmt.automation.models.NonAzureQueryProperties": "Microsoft.Automation.NonAzureQueryProperties", + "azure.mgmt.automation.models.Operation": "Microsoft.Automation.Operation", + "azure.mgmt.automation.models.OperationDisplay": "Microsoft.Automation.OperationDisplay", + "azure.mgmt.automation.models.OperationPropertiesFormat": "Microsoft.Automation.OperationPropertiesFormat", + "azure.mgmt.automation.models.OperationPropertiesFormatServiceSpecification": "Microsoft.Automation.OperationPropertiesFormatServiceSpecification", + "azure.mgmt.automation.models.Package": "Microsoft.Automation.Package", + "azure.mgmt.automation.models.PackageCreateOrUpdateParameters": "Microsoft.Automation.PackageCreateOrUpdateParameters", + "azure.mgmt.automation.models.PackageCreateOrUpdateProperties": "Microsoft.Automation.PackageCreateOrUpdateProperties", + "azure.mgmt.automation.models.PackageErrorInfo": "Microsoft.Automation.PackageErrorInfo", + "azure.mgmt.automation.models.PackageProperties": "Microsoft.Automation.PackageProperties", + "azure.mgmt.automation.models.PackageUpdateParameters": "Microsoft.Automation.PackageUpdateParameters", + "azure.mgmt.automation.models.PackageUpdateProperties": "Microsoft.Automation.PackageUpdateProperties", + "azure.mgmt.automation.models.PrivateEndpointConnection": "Microsoft.Automation.PrivateEndpointConnection", + "azure.mgmt.automation.models.PrivateEndpointConnectionProperties": "Microsoft.Automation.PrivateEndpointConnectionProperties", + "azure.mgmt.automation.models.PrivateEndpointProperty": "Microsoft.Automation.PrivateEndpointProperty", + "azure.mgmt.automation.models.PrivateLinkResource": "Microsoft.Automation.PrivateLinkResource", + "azure.mgmt.automation.models.PrivateLinkResourceProperties": "Microsoft.Automation.PrivateLinkResourceProperties", + "azure.mgmt.automation.models.PrivateLinkServiceConnectionStateProperty": "Microsoft.Automation.PrivateLinkServiceConnectionStateProperty", + "azure.mgmt.automation.models.PythonPackageCreateParameters": "Microsoft.Automation.PythonPackageCreateParameters", + "azure.mgmt.automation.models.PythonPackageCreateProperties": "Microsoft.Automation.PythonPackageCreateProperties", + "azure.mgmt.automation.models.PythonPackageUpdateParameters": "Microsoft.Automation.PythonPackageUpdateParameters", + "azure.mgmt.automation.models.RawGraphicalRunbookContent": "Microsoft.Automation.RawGraphicalRunbookContent", + "azure.mgmt.automation.models.RunAsCredentialAssociationProperty": "Microsoft.Automation.RunAsCredentialAssociationProperty", + "azure.mgmt.automation.models.Runbook": "Microsoft.Automation.Runbook", + "azure.mgmt.automation.models.RunbookAssociationProperty": "Microsoft.Automation.RunbookAssociationProperty", + "azure.mgmt.automation.models.RunbookCreateOrUpdateParameters": "Microsoft.Automation.RunbookCreateOrUpdateParameters", + "azure.mgmt.automation.models.RunbookCreateOrUpdateProperties": "Microsoft.Automation.RunbookCreateOrUpdateProperties", + "azure.mgmt.automation.models.RunbookDraft": "Microsoft.Automation.RunbookDraft", + "azure.mgmt.automation.models.RunbookDraftUndoEditResult": "Microsoft.Automation.RunbookDraftUndoEditResult", + "azure.mgmt.automation.models.RunbookParameter": "Microsoft.Automation.RunbookParameter", + "azure.mgmt.automation.models.RunbookProperties": "Microsoft.Automation.RunbookProperties", + "azure.mgmt.automation.models.RunbookUpdateParameters": "Microsoft.Automation.RunbookUpdateParameters", + "azure.mgmt.automation.models.RunbookUpdateProperties": "Microsoft.Automation.RunbookUpdateProperties", + "azure.mgmt.automation.models.RuntimeEnvironment": "Microsoft.Automation.RuntimeEnvironment", + "azure.mgmt.automation.models.RuntimeEnvironmentProperties": "Microsoft.Automation.RuntimeEnvironmentProperties", + "azure.mgmt.automation.models.RuntimeEnvironmentUpdateParameters": "Microsoft.Automation.RuntimeEnvironmentUpdateParameters", + "azure.mgmt.automation.models.RuntimeEnvironmentUpdateProperties": "Microsoft.Automation.RuntimeEnvironmentUpdateProperties", + "azure.mgmt.automation.models.RuntimeProperties": "Microsoft.Automation.RuntimeProperties", + "azure.mgmt.automation.models.Schedule": "Microsoft.Automation.Schedule", + "azure.mgmt.automation.models.ScheduleAssociationProperty": "Microsoft.Automation.ScheduleAssociationProperty", + "azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters": "Microsoft.Automation.ScheduleCreateOrUpdateParameters", + "azure.mgmt.automation.models.ScheduleCreateOrUpdateProperties": "Microsoft.Automation.ScheduleCreateOrUpdateProperties", + "azure.mgmt.automation.models.ScheduleProperties": "Microsoft.Automation.ScheduleProperties", + "azure.mgmt.automation.models.ScheduleUpdateParameters": "Microsoft.Automation.ScheduleUpdateParameters", + "azure.mgmt.automation.models.ScheduleUpdateProperties": "Microsoft.Automation.ScheduleUpdateProperties", + "azure.mgmt.automation.models.Sku": "Microsoft.Automation.Sku", + "azure.mgmt.automation.models.SoftwareUpdateConfiguration": "Microsoft.Automation.softwareUpdateConfiguration", + "azure.mgmt.automation.models.SoftwareUpdateConfigurationCollectionItem": "Microsoft.Automation.softwareUpdateConfigurationCollectionItem", + "azure.mgmt.automation.models.SoftwareUpdateConfigurationCollectionItemProperties": "Microsoft.Automation.softwareUpdateConfigurationCollectionItemProperties", + "azure.mgmt.automation.models.SoftwareUpdateConfigurationListResult": "Microsoft.Automation.softwareUpdateConfigurationListResult", + "azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun": "Microsoft.Automation.softwareUpdateConfigurationMachineRun", + "azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRunListResult": "Microsoft.Automation.softwareUpdateConfigurationMachineRunListResult", + "azure.mgmt.automation.models.SoftwareUpdateConfigurationProperties": "Microsoft.Automation.softwareUpdateConfigurationProperties", + "azure.mgmt.automation.models.SoftwareUpdateConfigurationRun": "Microsoft.Automation.softwareUpdateConfigurationRun", + "azure.mgmt.automation.models.SoftwareUpdateConfigurationRunListResult": "Microsoft.Automation.softwareUpdateConfigurationRunListResult", + "azure.mgmt.automation.models.SoftwareUpdateConfigurationRunProperties": "Microsoft.Automation.softwareUpdateConfigurationRunProperties", + "azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties": "Microsoft.Automation.softwareUpdateConfigurationRunTaskProperties", + "azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTasks": "Microsoft.Automation.softwareUpdateConfigurationRunTasks", + "azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks": "Microsoft.Automation.softwareUpdateConfigurationTasks", + "azure.mgmt.automation.models.SourceControl": "Microsoft.Automation.SourceControl", + "azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters": "Microsoft.Automation.SourceControlCreateOrUpdateParameters", + "azure.mgmt.automation.models.SourceControlCreateOrUpdateProperties": "Microsoft.Automation.SourceControlCreateOrUpdateProperties", + "azure.mgmt.automation.models.SourceControlProperties": "Microsoft.Automation.SourceControlProperties", + "azure.mgmt.automation.models.SourceControlSecurityTokenProperties": "Microsoft.Automation.SourceControlSecurityTokenProperties", + "azure.mgmt.automation.models.SourceControlSyncJob": "Microsoft.Automation.SourceControlSyncJob", + "azure.mgmt.automation.models.SourceControlSyncJobById": "Microsoft.Automation.SourceControlSyncJobById", + "azure.mgmt.automation.models.SourceControlSyncJobByIdProperties": "Microsoft.Automation.SourceControlSyncJobByIdProperties", + "azure.mgmt.automation.models.SourceControlSyncJobCreateParameters": "Microsoft.Automation.SourceControlSyncJobCreateParameters", + "azure.mgmt.automation.models.SourceControlSyncJobCreateProperties": "Microsoft.Automation.SourceControlSyncJobCreateProperties", + "azure.mgmt.automation.models.SourceControlSyncJobProperties": "Microsoft.Automation.SourceControlSyncJobProperties", + "azure.mgmt.automation.models.SourceControlSyncJobStream": "Microsoft.Automation.SourceControlSyncJobStream", + "azure.mgmt.automation.models.SourceControlSyncJobStreamById": "Microsoft.Automation.SourceControlSyncJobStreamById", + "azure.mgmt.automation.models.SourceControlSyncJobStreamByIdProperties": "Microsoft.Automation.SourceControlSyncJobStreamByIdProperties", + "azure.mgmt.automation.models.SourceControlSyncJobStreamProperties": "Microsoft.Automation.SourceControlSyncJobStreamProperties", + "azure.mgmt.automation.models.SourceControlUpdateParameters": "Microsoft.Automation.SourceControlUpdateParameters", + "azure.mgmt.automation.models.SourceControlUpdateProperties": "Microsoft.Automation.SourceControlUpdateProperties", + "azure.mgmt.automation.models.Statistics": "Microsoft.Automation.Statistics", + "azure.mgmt.automation.models.SUCScheduleProperties": "Microsoft.Automation.SUCScheduleProperties", + "azure.mgmt.automation.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.automation.models.TagSettingsProperties": "Microsoft.Automation.TagSettingsProperties", + "azure.mgmt.automation.models.TargetProperties": "Microsoft.Automation.TargetProperties", + "azure.mgmt.automation.models.TaskProperties": "Microsoft.Automation.taskProperties", + "azure.mgmt.automation.models.TestJob": "Microsoft.Automation.TestJob", + "azure.mgmt.automation.models.TestJobCreateParameters": "Microsoft.Automation.TestJobCreateParameters", + "azure.mgmt.automation.models.TypeField": "Microsoft.Automation.TypeField", + "azure.mgmt.automation.models.UpdateConfiguration": "Microsoft.Automation.updateConfiguration", + "azure.mgmt.automation.models.UpdateConfigurationMachineRunProperties": "Microsoft.Automation.updateConfigurationMachineRunProperties", + "azure.mgmt.automation.models.UpdateConfigurationNavigation": "Microsoft.Automation.updateConfigurationNavigation", + "azure.mgmt.automation.models.Usage": "Microsoft.Automation.Usage", + "azure.mgmt.automation.models.UsageCounterName": "Microsoft.Automation.UsageCounterName", + "azure.mgmt.automation.models.UserAssignedIdentitiesProperties": "Microsoft.Automation.UserAssignedIdentitiesProperties", + "azure.mgmt.automation.models.Variable": "Microsoft.Automation.Variable", + "azure.mgmt.automation.models.VariableCreateOrUpdateParameters": "Microsoft.Automation.VariableCreateOrUpdateParameters", + "azure.mgmt.automation.models.VariableCreateOrUpdateProperties": "Microsoft.Automation.VariableCreateOrUpdateProperties", + "azure.mgmt.automation.models.VariableProperties": "Microsoft.Automation.VariableProperties", + "azure.mgmt.automation.models.VariableUpdateParameters": "Microsoft.Automation.VariableUpdateParameters", + "azure.mgmt.automation.models.VariableUpdateProperties": "Microsoft.Automation.VariableUpdateProperties", + "azure.mgmt.automation.models.Watcher": "Microsoft.Automation.Watcher", + "azure.mgmt.automation.models.WatcherProperties": "Microsoft.Automation.WatcherProperties", + "azure.mgmt.automation.models.WatcherUpdateParameters": "Microsoft.Automation.WatcherUpdateParameters", + "azure.mgmt.automation.models.WatcherUpdateProperties": "Microsoft.Automation.WatcherUpdateProperties", + "azure.mgmt.automation.models.Webhook": "Microsoft.Automation.Webhook", + "azure.mgmt.automation.models.WebhookCreateOrUpdateParameters": "Microsoft.Automation.WebhookCreateOrUpdateParameters", + "azure.mgmt.automation.models.WebhookCreateOrUpdateProperties": "Microsoft.Automation.WebhookCreateOrUpdateProperties", + "azure.mgmt.automation.models.WebhookProperties": "Microsoft.Automation.WebhookProperties", + "azure.mgmt.automation.models.WebhookUpdateParameters": "Microsoft.Automation.WebhookUpdateParameters", + "azure.mgmt.automation.models.WebhookUpdateProperties": "Microsoft.Automation.WebhookUpdateProperties", + "azure.mgmt.automation.models.WindowsProperties": "Microsoft.Automation.WindowsProperties", + "azure.mgmt.automation.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.automation.models.OperatingSystemType": "Microsoft.Automation.OperatingSystemType", + "azure.mgmt.automation.models.WindowsUpdateClasses": "Microsoft.Automation.WindowsUpdateClasses", + "azure.mgmt.automation.models.LinuxUpdateClasses": "Microsoft.Automation.LinuxUpdateClasses", + "azure.mgmt.automation.models.TagOperators": "Microsoft.Automation.TagOperators", + "azure.mgmt.automation.models.ScheduleFrequency": "Microsoft.Automation.ScheduleFrequency", + "azure.mgmt.automation.models.ScheduleDay": "Microsoft.Automation.ScheduleDay", + "azure.mgmt.automation.models.WorkerType": "Microsoft.Automation.WorkerType", + "azure.mgmt.automation.models.ModuleProvisioningState": "Microsoft.Automation.ModuleProvisioningState", + "azure.mgmt.automation.models.SkuNameEnum": "Microsoft.Automation.SkuNameEnum", + "azure.mgmt.automation.models.AutomationAccountState": "Microsoft.Automation.AutomationAccountState", + "azure.mgmt.automation.models.EncryptionKeySourceType": "Microsoft.Automation.EncryptionKeySourceType", + "azure.mgmt.automation.models.ResourceIdentityType": "Microsoft.Automation.ResourceIdentityType", + "azure.mgmt.automation.models.CountType": "Microsoft.Automation.CountType", + "azure.mgmt.automation.models.AgentRegistrationKeyName": "Microsoft.Automation.AgentRegistrationKeyName", + "azure.mgmt.automation.models.AutomationKeyName": "Microsoft.Automation.AutomationKeyName", + "azure.mgmt.automation.models.AutomationKeyPermissions": "Microsoft.Automation.AutomationKeyPermissions", + "azure.mgmt.automation.models.JobStatus": "Microsoft.Automation.JobStatus", + "azure.mgmt.automation.models.JobProvisioningState": "Microsoft.Automation.JobProvisioningState", + "azure.mgmt.automation.models.ContentSourceType": "Microsoft.Automation.ContentSourceType", + "azure.mgmt.automation.models.DscConfigurationState": "Microsoft.Automation.DscConfigurationState", + "azure.mgmt.automation.models.GroupTypeEnum": "Microsoft.Automation.GroupTypeEnum", + "azure.mgmt.automation.models.JobStreamType": "Microsoft.Automation.JobStreamType", + "azure.mgmt.automation.models.PackageProvisioningState": "Microsoft.Automation.PackageProvisioningState", + "azure.mgmt.automation.models.RunbookTypeEnum": "Microsoft.Automation.RunbookTypeEnum", + "azure.mgmt.automation.models.RunbookState": "Microsoft.Automation.RunbookState", + "azure.mgmt.automation.models.HttpStatusCode": "Microsoft.Automation.HttpStatusCode", + "azure.mgmt.automation.models.SourceType": "Microsoft.Automation.SourceType", + "azure.mgmt.automation.models.TokenType": "Microsoft.Automation.TokenType", + "azure.mgmt.automation.models.ProvisioningState": "Microsoft.Automation.ProvisioningState", + "azure.mgmt.automation.models.SyncType": "Microsoft.Automation.SyncType", + "azure.mgmt.automation.models.StreamType": "Microsoft.Automation.StreamType", + "azure.mgmt.automation.models.GraphRunbookType": "Microsoft.Automation.GraphRunbookType", + "azure.mgmt.automation.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.automation.aio.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationsOperations.get_by_name": "Microsoft.Automation.SoftwareUpdateConfigurations.getByName", + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationsOperations.get_by_name": "Microsoft.Automation.SoftwareUpdateConfigurations.getByName", + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationsOperations.create": "Microsoft.Automation.SoftwareUpdateConfigurations.create", + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationsOperations.create": "Microsoft.Automation.SoftwareUpdateConfigurations.create", + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationsOperations.delete": "Microsoft.Automation.SoftwareUpdateConfigurations.delete", + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationsOperations.delete": "Microsoft.Automation.SoftwareUpdateConfigurations.delete", + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationsOperations.list": "Microsoft.Automation.AutomationAccounts.softwareUpdateConfigurationsList", + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationsOperations.list": "Microsoft.Automation.AutomationAccounts.softwareUpdateConfigurationsList", + "azure.mgmt.automation.operations.HybridRunbookWorkersOperations.get": "Microsoft.Automation.HybridRunbookWorkers.get", + "azure.mgmt.automation.aio.operations.HybridRunbookWorkersOperations.get": "Microsoft.Automation.HybridRunbookWorkers.get", + "azure.mgmt.automation.operations.HybridRunbookWorkersOperations.create": "Microsoft.Automation.HybridRunbookWorkers.create", + "azure.mgmt.automation.aio.operations.HybridRunbookWorkersOperations.create": "Microsoft.Automation.HybridRunbookWorkers.create", + "azure.mgmt.automation.operations.HybridRunbookWorkersOperations.patch": "Microsoft.Automation.HybridRunbookWorkers.patch", + "azure.mgmt.automation.aio.operations.HybridRunbookWorkersOperations.patch": "Microsoft.Automation.HybridRunbookWorkers.patch", + "azure.mgmt.automation.operations.HybridRunbookWorkersOperations.delete": "Microsoft.Automation.HybridRunbookWorkers.delete", + "azure.mgmt.automation.aio.operations.HybridRunbookWorkersOperations.delete": "Microsoft.Automation.HybridRunbookWorkers.delete", + "azure.mgmt.automation.operations.HybridRunbookWorkersOperations.list_by_hybrid_runbook_worker_group": "Microsoft.Automation.HybridRunbookWorkers.listByHybridRunbookWorkerGroup", + "azure.mgmt.automation.aio.operations.HybridRunbookWorkersOperations.list_by_hybrid_runbook_worker_group": "Microsoft.Automation.HybridRunbookWorkers.listByHybridRunbookWorkerGroup", + "azure.mgmt.automation.operations.HybridRunbookWorkersOperations.move": "Microsoft.Automation.HybridRunbookWorkers.move", + "azure.mgmt.automation.aio.operations.HybridRunbookWorkersOperations.move": "Microsoft.Automation.HybridRunbookWorkers.move", + "azure.mgmt.automation.operations.Python2PackageOperations.get": "Microsoft.Automation.Python2Package.get", + "azure.mgmt.automation.aio.operations.Python2PackageOperations.get": "Microsoft.Automation.Python2Package.get", + "azure.mgmt.automation.operations.Python2PackageOperations.create_or_update": "Microsoft.Automation.Python2Package.createOrUpdate", + "azure.mgmt.automation.aio.operations.Python2PackageOperations.create_or_update": "Microsoft.Automation.Python2Package.createOrUpdate", + "azure.mgmt.automation.operations.Python2PackageOperations.update": "Microsoft.Automation.Python2Package.update", + "azure.mgmt.automation.aio.operations.Python2PackageOperations.update": "Microsoft.Automation.Python2Package.update", + "azure.mgmt.automation.operations.Python2PackageOperations.delete": "Microsoft.Automation.Python2Package.delete", + "azure.mgmt.automation.aio.operations.Python2PackageOperations.delete": "Microsoft.Automation.Python2Package.delete", + "azure.mgmt.automation.operations.Python2PackageOperations.list_by_automation_account": "Microsoft.Automation.Python2Package.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.Python2PackageOperations.list_by_automation_account": "Microsoft.Automation.Python2Package.listByAutomationAccount", + "azure.mgmt.automation.operations.Python3PackageOperations.get": "Microsoft.Automation.Python3Package.get", + "azure.mgmt.automation.aio.operations.Python3PackageOperations.get": "Microsoft.Automation.Python3Package.get", + "azure.mgmt.automation.operations.Python3PackageOperations.create_or_update": "Microsoft.Automation.Python3Package.createOrUpdate", + "azure.mgmt.automation.aio.operations.Python3PackageOperations.create_or_update": "Microsoft.Automation.Python3Package.createOrUpdate", + "azure.mgmt.automation.operations.Python3PackageOperations.update": "Microsoft.Automation.Python3Package.update", + "azure.mgmt.automation.aio.operations.Python3PackageOperations.update": "Microsoft.Automation.Python3Package.update", + "azure.mgmt.automation.operations.Python3PackageOperations.delete": "Microsoft.Automation.Python3Package.delete", + "azure.mgmt.automation.aio.operations.Python3PackageOperations.delete": "Microsoft.Automation.Python3Package.delete", + "azure.mgmt.automation.operations.Python3PackageOperations.list_by_automation_account": "Microsoft.Automation.Python3Package.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.Python3PackageOperations.list_by_automation_account": "Microsoft.Automation.Python3Package.listByAutomationAccount", + "azure.mgmt.automation.operations.RuntimeEnvironmentsOperations.get": "Microsoft.Automation.RuntimeEnvironments.get", + "azure.mgmt.automation.aio.operations.RuntimeEnvironmentsOperations.get": "Microsoft.Automation.RuntimeEnvironments.get", + "azure.mgmt.automation.operations.RuntimeEnvironmentsOperations.create": "Microsoft.Automation.RuntimeEnvironments.create", + "azure.mgmt.automation.aio.operations.RuntimeEnvironmentsOperations.create": "Microsoft.Automation.RuntimeEnvironments.create", + "azure.mgmt.automation.operations.RuntimeEnvironmentsOperations.update": "Microsoft.Automation.RuntimeEnvironments.update", + "azure.mgmt.automation.aio.operations.RuntimeEnvironmentsOperations.update": "Microsoft.Automation.RuntimeEnvironments.update", + "azure.mgmt.automation.operations.RuntimeEnvironmentsOperations.delete": "Microsoft.Automation.RuntimeEnvironments.delete", + "azure.mgmt.automation.aio.operations.RuntimeEnvironmentsOperations.delete": "Microsoft.Automation.RuntimeEnvironments.delete", + "azure.mgmt.automation.operations.RuntimeEnvironmentsOperations.list_by_automation_account": "Microsoft.Automation.RuntimeEnvironments.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.RuntimeEnvironmentsOperations.list_by_automation_account": "Microsoft.Automation.RuntimeEnvironments.listByAutomationAccount", + "azure.mgmt.automation.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.Automation.PrivateEndpointConnections.get", + "azure.mgmt.automation.aio.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.Automation.PrivateEndpointConnections.get", + "azure.mgmt.automation.operations.PrivateEndpointConnectionsOperations.begin_create_or_update": "Microsoft.Automation.PrivateEndpointConnections.createOrUpdate", + "azure.mgmt.automation.aio.operations.PrivateEndpointConnectionsOperations.begin_create_or_update": "Microsoft.Automation.PrivateEndpointConnections.createOrUpdate", + "azure.mgmt.automation.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.Automation.PrivateEndpointConnections.delete", + "azure.mgmt.automation.aio.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.Automation.PrivateEndpointConnections.delete", + "azure.mgmt.automation.operations.PrivateEndpointConnectionsOperations.list_by_automation_account": "Microsoft.Automation.PrivateEndpointConnections.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.PrivateEndpointConnectionsOperations.list_by_automation_account": "Microsoft.Automation.PrivateEndpointConnections.listByAutomationAccount", + "azure.mgmt.automation.operations.AutomationAccountOperations.get": "Microsoft.Automation.AutomationAccounts.get", + "azure.mgmt.automation.aio.operations.AutomationAccountOperations.get": "Microsoft.Automation.AutomationAccounts.get", + "azure.mgmt.automation.operations.AutomationAccountOperations.create_or_update": "Microsoft.Automation.AutomationAccounts.createOrUpdate", + "azure.mgmt.automation.aio.operations.AutomationAccountOperations.create_or_update": "Microsoft.Automation.AutomationAccounts.createOrUpdate", + "azure.mgmt.automation.operations.AutomationAccountOperations.update": "Microsoft.Automation.AutomationAccounts.update", + "azure.mgmt.automation.aio.operations.AutomationAccountOperations.update": "Microsoft.Automation.AutomationAccounts.update", + "azure.mgmt.automation.operations.AutomationAccountOperations.delete": "Microsoft.Automation.AutomationAccounts.delete", + "azure.mgmt.automation.aio.operations.AutomationAccountOperations.delete": "Microsoft.Automation.AutomationAccounts.delete", + "azure.mgmt.automation.operations.AutomationAccountOperations.list_by_resource_group": "Microsoft.Automation.AutomationAccounts.listByResourceGroup", + "azure.mgmt.automation.aio.operations.AutomationAccountOperations.list_by_resource_group": "Microsoft.Automation.AutomationAccounts.listByResourceGroup", + "azure.mgmt.automation.operations.AutomationAccountOperations.list": "Microsoft.Automation.AutomationAccounts.list", + "azure.mgmt.automation.aio.operations.AutomationAccountOperations.list": "Microsoft.Automation.AutomationAccounts.list", + "azure.mgmt.automation.operations.AutomationAccountOperations.list_deleted_runbooks": "Microsoft.Automation.AutomationAccounts.listDeletedRunbooks", + "azure.mgmt.automation.aio.operations.AutomationAccountOperations.list_deleted_runbooks": "Microsoft.Automation.AutomationAccounts.listDeletedRunbooks", + "azure.mgmt.automation.operations.NodeCountInformationOperations.get": "Microsoft.Automation.AutomationAccounts.nodeCountInformationGet", + "azure.mgmt.automation.aio.operations.NodeCountInformationOperations.get": "Microsoft.Automation.AutomationAccounts.nodeCountInformationGet", + "azure.mgmt.automation.operations.PrivateLinkResourcesOperations.automation": "Microsoft.Automation.AutomationAccounts.automation", + "azure.mgmt.automation.aio.operations.PrivateLinkResourcesOperations.automation": "Microsoft.Automation.AutomationAccounts.automation", + "azure.mgmt.automation.operations.AgentRegistrationInformationOperations.get": "Microsoft.Automation.AutomationAccounts.agentRegistrationInformationGet", + "azure.mgmt.automation.aio.operations.AgentRegistrationInformationOperations.get": "Microsoft.Automation.AutomationAccounts.agentRegistrationInformationGet", + "azure.mgmt.automation.operations.AgentRegistrationInformationOperations.regenerate_key": "Microsoft.Automation.AutomationAccounts.regenerateKey", + "azure.mgmt.automation.aio.operations.AgentRegistrationInformationOperations.regenerate_key": "Microsoft.Automation.AutomationAccounts.regenerateKey", + "azure.mgmt.automation.operations.StatisticsOperations.list_by_automation_account": "Microsoft.Automation.AutomationAccounts.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.StatisticsOperations.list_by_automation_account": "Microsoft.Automation.AutomationAccounts.listByAutomationAccount", + "azure.mgmt.automation.operations.UsagesOperations.list_by_automation_account": "Microsoft.Automation.AutomationAccounts.usagesListByAutomationAccount", + "azure.mgmt.automation.aio.operations.UsagesOperations.list_by_automation_account": "Microsoft.Automation.AutomationAccounts.usagesListByAutomationAccount", + "azure.mgmt.automation.operations.KeysOperations.list_by_automation_account": "Microsoft.Automation.AutomationAccounts.keysListByAutomationAccount", + "azure.mgmt.automation.aio.operations.KeysOperations.list_by_automation_account": "Microsoft.Automation.AutomationAccounts.keysListByAutomationAccount", + "azure.mgmt.automation.operations.JobOperations.list_by_automation_account": "Microsoft.Automation.AutomationAccounts.jobListByAutomationAccount", + "azure.mgmt.automation.aio.operations.JobOperations.list_by_automation_account": "Microsoft.Automation.AutomationAccounts.jobListByAutomationAccount", + "azure.mgmt.automation.operations.JobOperations.get": "Microsoft.Automation.Jobs.get", + "azure.mgmt.automation.aio.operations.JobOperations.get": "Microsoft.Automation.Jobs.get", + "azure.mgmt.automation.operations.JobOperations.create": "Microsoft.Automation.Jobs.create", + "azure.mgmt.automation.aio.operations.JobOperations.create": "Microsoft.Automation.Jobs.create", + "azure.mgmt.automation.operations.JobOperations.get_output": "Microsoft.Automation.Jobs.getOutput", + "azure.mgmt.automation.aio.operations.JobOperations.get_output": "Microsoft.Automation.Jobs.getOutput", + "azure.mgmt.automation.operations.JobOperations.get_runbook_content": "Microsoft.Automation.Jobs.getRunbookContent", + "azure.mgmt.automation.aio.operations.JobOperations.get_runbook_content": "Microsoft.Automation.Jobs.getRunbookContent", + "azure.mgmt.automation.operations.JobOperations.suspend": "Microsoft.Automation.Jobs.suspend", + "azure.mgmt.automation.aio.operations.JobOperations.suspend": "Microsoft.Automation.Jobs.suspend", + "azure.mgmt.automation.operations.JobOperations.stop": "Microsoft.Automation.Jobs.stop", + "azure.mgmt.automation.aio.operations.JobOperations.stop": "Microsoft.Automation.Jobs.stop", + "azure.mgmt.automation.operations.JobOperations.resume": "Microsoft.Automation.Jobs.resume", + "azure.mgmt.automation.aio.operations.JobOperations.resume": "Microsoft.Automation.Jobs.resume", + "azure.mgmt.automation.operations.LinkedWorkspaceOperations.get": "Microsoft.Automation.AutomationAccounts.linkedWorkspaceGet", + "azure.mgmt.automation.aio.operations.LinkedWorkspaceOperations.get": "Microsoft.Automation.AutomationAccounts.linkedWorkspaceGet", + "azure.mgmt.automation.operations.ObjectDataTypesOperations.list_fields_by_type": "Microsoft.Automation.AutomationAccounts.listFieldsByType", + "azure.mgmt.automation.aio.operations.ObjectDataTypesOperations.list_fields_by_type": "Microsoft.Automation.AutomationAccounts.listFieldsByType", + "azure.mgmt.automation.operations.ObjectDataTypesOperations.list_fields_by_module_and_type": "Microsoft.Automation.Modules.listFieldsByModuleAndType", + "azure.mgmt.automation.aio.operations.ObjectDataTypesOperations.list_fields_by_module_and_type": "Microsoft.Automation.Modules.listFieldsByModuleAndType", + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationMachineRunsOperations.get_by_id": "Microsoft.Automation.AutomationAccounts.getById", + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationMachineRunsOperations.get_by_id": "Microsoft.Automation.AutomationAccounts.getById", + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationMachineRunsOperations.list": "Microsoft.Automation.AutomationAccounts.softwareUpdateConfigurationMachineRunsList", + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationMachineRunsOperations.list": "Microsoft.Automation.AutomationAccounts.softwareUpdateConfigurationMachineRunsList", + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationRunsOperations.get_by_id": "Microsoft.Automation.AutomationAccounts.softwareUpdateConfigurationRunsGetById", + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationRunsOperations.get_by_id": "Microsoft.Automation.AutomationAccounts.softwareUpdateConfigurationRunsGetById", + "azure.mgmt.automation.operations.SoftwareUpdateConfigurationRunsOperations.list": "Microsoft.Automation.AutomationAccounts.softwareUpdateConfigurationRunsList", + "azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationRunsOperations.list": "Microsoft.Automation.AutomationAccounts.softwareUpdateConfigurationRunsList", + "azure.mgmt.automation.operations.WebhookOperations.generate_uri": "Microsoft.Automation.AutomationAccounts.generateUri", + "azure.mgmt.automation.aio.operations.WebhookOperations.generate_uri": "Microsoft.Automation.AutomationAccounts.generateUri", + "azure.mgmt.automation.operations.WebhookOperations.get": "Microsoft.Automation.Webhooks.get", + "azure.mgmt.automation.aio.operations.WebhookOperations.get": "Microsoft.Automation.Webhooks.get", + "azure.mgmt.automation.operations.WebhookOperations.create_or_update": "Microsoft.Automation.Webhooks.createOrUpdate", + "azure.mgmt.automation.aio.operations.WebhookOperations.create_or_update": "Microsoft.Automation.Webhooks.createOrUpdate", + "azure.mgmt.automation.operations.WebhookOperations.update": "Microsoft.Automation.Webhooks.update", + "azure.mgmt.automation.aio.operations.WebhookOperations.update": "Microsoft.Automation.Webhooks.update", + "azure.mgmt.automation.operations.WebhookOperations.delete": "Microsoft.Automation.Webhooks.delete", + "azure.mgmt.automation.aio.operations.WebhookOperations.delete": "Microsoft.Automation.Webhooks.delete", + "azure.mgmt.automation.operations.WebhookOperations.list_by_automation_account": "Microsoft.Automation.Webhooks.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.WebhookOperations.list_by_automation_account": "Microsoft.Automation.Webhooks.listByAutomationAccount", + "azure.mgmt.automation.operations.DscNodeOperations.get": "Microsoft.Automation.DscNodes.get", + "azure.mgmt.automation.aio.operations.DscNodeOperations.get": "Microsoft.Automation.DscNodes.get", + "azure.mgmt.automation.operations.DscNodeOperations.update": "Microsoft.Automation.DscNodes.update", + "azure.mgmt.automation.aio.operations.DscNodeOperations.update": "Microsoft.Automation.DscNodes.update", + "azure.mgmt.automation.operations.DscNodeOperations.delete": "Microsoft.Automation.DscNodes.delete", + "azure.mgmt.automation.aio.operations.DscNodeOperations.delete": "Microsoft.Automation.DscNodes.delete", + "azure.mgmt.automation.operations.DscNodeOperations.list_by_automation_account": "Microsoft.Automation.DscNodes.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.DscNodeOperations.list_by_automation_account": "Microsoft.Automation.DscNodes.listByAutomationAccount", + "azure.mgmt.automation.operations.NodeReportsOperations.list_by_node": "Microsoft.Automation.DscNodes.listByNode", + "azure.mgmt.automation.aio.operations.NodeReportsOperations.list_by_node": "Microsoft.Automation.DscNodes.listByNode", + "azure.mgmt.automation.operations.NodeReportsOperations.get": "Microsoft.Automation.DscNodes.nodeReportsGet", + "azure.mgmt.automation.aio.operations.NodeReportsOperations.get": "Microsoft.Automation.DscNodes.nodeReportsGet", + "azure.mgmt.automation.operations.NodeReportsOperations.get_content": "Microsoft.Automation.DscNodes.getContent", + "azure.mgmt.automation.aio.operations.NodeReportsOperations.get_content": "Microsoft.Automation.DscNodes.getContent", + "azure.mgmt.automation.operations.CertificateOperations.get": "Microsoft.Automation.Certificates.get", + "azure.mgmt.automation.aio.operations.CertificateOperations.get": "Microsoft.Automation.Certificates.get", + "azure.mgmt.automation.operations.CertificateOperations.create_or_update": "Microsoft.Automation.Certificates.createOrUpdate", + "azure.mgmt.automation.aio.operations.CertificateOperations.create_or_update": "Microsoft.Automation.Certificates.createOrUpdate", + "azure.mgmt.automation.operations.CertificateOperations.update": "Microsoft.Automation.Certificates.update", + "azure.mgmt.automation.aio.operations.CertificateOperations.update": "Microsoft.Automation.Certificates.update", + "azure.mgmt.automation.operations.CertificateOperations.delete": "Microsoft.Automation.Certificates.delete", + "azure.mgmt.automation.aio.operations.CertificateOperations.delete": "Microsoft.Automation.Certificates.delete", + "azure.mgmt.automation.operations.CertificateOperations.list_by_automation_account": "Microsoft.Automation.Certificates.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.CertificateOperations.list_by_automation_account": "Microsoft.Automation.Certificates.listByAutomationAccount", + "azure.mgmt.automation.operations.ConnectionOperations.get": "Microsoft.Automation.Connections.get", + "azure.mgmt.automation.aio.operations.ConnectionOperations.get": "Microsoft.Automation.Connections.get", + "azure.mgmt.automation.operations.ConnectionOperations.create_or_update": "Microsoft.Automation.Connections.createOrUpdate", + "azure.mgmt.automation.aio.operations.ConnectionOperations.create_or_update": "Microsoft.Automation.Connections.createOrUpdate", + "azure.mgmt.automation.operations.ConnectionOperations.update": "Microsoft.Automation.Connections.update", + "azure.mgmt.automation.aio.operations.ConnectionOperations.update": "Microsoft.Automation.Connections.update", + "azure.mgmt.automation.operations.ConnectionOperations.delete": "Microsoft.Automation.Connections.delete", + "azure.mgmt.automation.aio.operations.ConnectionOperations.delete": "Microsoft.Automation.Connections.delete", + "azure.mgmt.automation.operations.ConnectionOperations.list_by_automation_account": "Microsoft.Automation.Connections.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.ConnectionOperations.list_by_automation_account": "Microsoft.Automation.Connections.listByAutomationAccount", + "azure.mgmt.automation.operations.ConnectionTypeOperations.get": "Microsoft.Automation.ConnectionTypes.get", + "azure.mgmt.automation.aio.operations.ConnectionTypeOperations.get": "Microsoft.Automation.ConnectionTypes.get", + "azure.mgmt.automation.operations.ConnectionTypeOperations.create_or_update": "Microsoft.Automation.ConnectionTypes.createOrUpdate", + "azure.mgmt.automation.aio.operations.ConnectionTypeOperations.create_or_update": "Microsoft.Automation.ConnectionTypes.createOrUpdate", + "azure.mgmt.automation.operations.ConnectionTypeOperations.delete": "Microsoft.Automation.ConnectionTypes.delete", + "azure.mgmt.automation.aio.operations.ConnectionTypeOperations.delete": "Microsoft.Automation.ConnectionTypes.delete", + "azure.mgmt.automation.operations.ConnectionTypeOperations.list_by_automation_account": "Microsoft.Automation.ConnectionTypes.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.ConnectionTypeOperations.list_by_automation_account": "Microsoft.Automation.ConnectionTypes.listByAutomationAccount", + "azure.mgmt.automation.operations.CredentialOperations.get": "Microsoft.Automation.Credentials.get", + "azure.mgmt.automation.aio.operations.CredentialOperations.get": "Microsoft.Automation.Credentials.get", + "azure.mgmt.automation.operations.CredentialOperations.create_or_update": "Microsoft.Automation.Credentials.createOrUpdate", + "azure.mgmt.automation.aio.operations.CredentialOperations.create_or_update": "Microsoft.Automation.Credentials.createOrUpdate", + "azure.mgmt.automation.operations.CredentialOperations.update": "Microsoft.Automation.Credentials.update", + "azure.mgmt.automation.aio.operations.CredentialOperations.update": "Microsoft.Automation.Credentials.update", + "azure.mgmt.automation.operations.CredentialOperations.delete": "Microsoft.Automation.Credentials.delete", + "azure.mgmt.automation.aio.operations.CredentialOperations.delete": "Microsoft.Automation.Credentials.delete", + "azure.mgmt.automation.operations.CredentialOperations.list_by_automation_account": "Microsoft.Automation.Credentials.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.CredentialOperations.list_by_automation_account": "Microsoft.Automation.Credentials.listByAutomationAccount", + "azure.mgmt.automation.operations.DscConfigurationOperations.get": "Microsoft.Automation.DscConfigurations.get", + "azure.mgmt.automation.aio.operations.DscConfigurationOperations.get": "Microsoft.Automation.DscConfigurations.get", + "azure.mgmt.automation.operations.DscConfigurationOperations.create_or_update": "Microsoft.Automation.DscConfigurations.createOrUpdate", + "azure.mgmt.automation.aio.operations.DscConfigurationOperations.create_or_update": "Microsoft.Automation.DscConfigurations.createOrUpdate", + "azure.mgmt.automation.operations.DscConfigurationOperations.update": "Microsoft.Automation.DscConfigurations.update", + "azure.mgmt.automation.aio.operations.DscConfigurationOperations.update": "Microsoft.Automation.DscConfigurations.update", + "azure.mgmt.automation.operations.DscConfigurationOperations.delete": "Microsoft.Automation.DscConfigurations.delete", + "azure.mgmt.automation.aio.operations.DscConfigurationOperations.delete": "Microsoft.Automation.DscConfigurations.delete", + "azure.mgmt.automation.operations.DscConfigurationOperations.list_by_automation_account": "Microsoft.Automation.DscConfigurations.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.DscConfigurationOperations.list_by_automation_account": "Microsoft.Automation.DscConfigurations.listByAutomationAccount", + "azure.mgmt.automation.operations.DscConfigurationOperations.get_content": "Microsoft.Automation.DscConfigurations.getContent", + "azure.mgmt.automation.aio.operations.DscConfigurationOperations.get_content": "Microsoft.Automation.DscConfigurations.getContent", + "azure.mgmt.automation.operations.DscNodeConfigurationOperations.get": "Microsoft.Automation.DscNodeConfigurations.get", + "azure.mgmt.automation.aio.operations.DscNodeConfigurationOperations.get": "Microsoft.Automation.DscNodeConfigurations.get", + "azure.mgmt.automation.operations.DscNodeConfigurationOperations.begin_create_or_update": "Microsoft.Automation.DscNodeConfigurations.createOrUpdate", + "azure.mgmt.automation.aio.operations.DscNodeConfigurationOperations.begin_create_or_update": "Microsoft.Automation.DscNodeConfigurations.createOrUpdate", + "azure.mgmt.automation.operations.DscNodeConfigurationOperations.delete": "Microsoft.Automation.DscNodeConfigurations.delete", + "azure.mgmt.automation.aio.operations.DscNodeConfigurationOperations.delete": "Microsoft.Automation.DscNodeConfigurations.delete", + "azure.mgmt.automation.operations.DscNodeConfigurationOperations.list_by_automation_account": "Microsoft.Automation.DscNodeConfigurations.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.DscNodeConfigurationOperations.list_by_automation_account": "Microsoft.Automation.DscNodeConfigurations.listByAutomationAccount", + "azure.mgmt.automation.operations.HybridRunbookWorkerGroupOperations.get": "Microsoft.Automation.HybridRunbookWorkerGroups.get", + "azure.mgmt.automation.aio.operations.HybridRunbookWorkerGroupOperations.get": "Microsoft.Automation.HybridRunbookWorkerGroups.get", + "azure.mgmt.automation.operations.HybridRunbookWorkerGroupOperations.create": "Microsoft.Automation.HybridRunbookWorkerGroups.create", + "azure.mgmt.automation.aio.operations.HybridRunbookWorkerGroupOperations.create": "Microsoft.Automation.HybridRunbookWorkerGroups.create", + "azure.mgmt.automation.operations.HybridRunbookWorkerGroupOperations.update": "Microsoft.Automation.HybridRunbookWorkerGroups.update", + "azure.mgmt.automation.aio.operations.HybridRunbookWorkerGroupOperations.update": "Microsoft.Automation.HybridRunbookWorkerGroups.update", + "azure.mgmt.automation.operations.HybridRunbookWorkerGroupOperations.delete": "Microsoft.Automation.HybridRunbookWorkerGroups.delete", + "azure.mgmt.automation.aio.operations.HybridRunbookWorkerGroupOperations.delete": "Microsoft.Automation.HybridRunbookWorkerGroups.delete", + "azure.mgmt.automation.operations.HybridRunbookWorkerGroupOperations.list_by_automation_account": "Microsoft.Automation.HybridRunbookWorkerGroups.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.HybridRunbookWorkerGroupOperations.list_by_automation_account": "Microsoft.Automation.HybridRunbookWorkerGroups.listByAutomationAccount", + "azure.mgmt.automation.operations.JobStreamOperations.get": "Microsoft.Automation.Jobs.jobStreamGet", + "azure.mgmt.automation.aio.operations.JobStreamOperations.get": "Microsoft.Automation.Jobs.jobStreamGet", + "azure.mgmt.automation.operations.JobStreamOperations.list_by_job": "Microsoft.Automation.Jobs.listByJob", + "azure.mgmt.automation.aio.operations.JobStreamOperations.list_by_job": "Microsoft.Automation.Jobs.listByJob", + "azure.mgmt.automation.operations.JobScheduleOperations.get": "Microsoft.Automation.JobSchedules.get", + "azure.mgmt.automation.aio.operations.JobScheduleOperations.get": "Microsoft.Automation.JobSchedules.get", + "azure.mgmt.automation.operations.JobScheduleOperations.create": "Microsoft.Automation.JobSchedules.create", + "azure.mgmt.automation.aio.operations.JobScheduleOperations.create": "Microsoft.Automation.JobSchedules.create", + "azure.mgmt.automation.operations.JobScheduleOperations.delete": "Microsoft.Automation.JobSchedules.delete", + "azure.mgmt.automation.aio.operations.JobScheduleOperations.delete": "Microsoft.Automation.JobSchedules.delete", + "azure.mgmt.automation.operations.JobScheduleOperations.list_by_automation_account": "Microsoft.Automation.JobSchedules.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.JobScheduleOperations.list_by_automation_account": "Microsoft.Automation.JobSchedules.listByAutomationAccount", + "azure.mgmt.automation.operations.ModuleOperations.get": "Microsoft.Automation.Modules.get", + "azure.mgmt.automation.aio.operations.ModuleOperations.get": "Microsoft.Automation.Modules.get", + "azure.mgmt.automation.operations.ModuleOperations.create_or_update": "Microsoft.Automation.Modules.createOrUpdate", + "azure.mgmt.automation.aio.operations.ModuleOperations.create_or_update": "Microsoft.Automation.Modules.createOrUpdate", + "azure.mgmt.automation.operations.ModuleOperations.update": "Microsoft.Automation.Modules.update", + "azure.mgmt.automation.aio.operations.ModuleOperations.update": "Microsoft.Automation.Modules.update", + "azure.mgmt.automation.operations.ModuleOperations.delete": "Microsoft.Automation.Modules.delete", + "azure.mgmt.automation.aio.operations.ModuleOperations.delete": "Microsoft.Automation.Modules.delete", + "azure.mgmt.automation.operations.ModuleOperations.list_by_automation_account": "Microsoft.Automation.Modules.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.ModuleOperations.list_by_automation_account": "Microsoft.Automation.Modules.listByAutomationAccount", + "azure.mgmt.automation.operations.ActivityOperations.get": "Microsoft.Automation.Modules.activityGet", + "azure.mgmt.automation.aio.operations.ActivityOperations.get": "Microsoft.Automation.Modules.activityGet", + "azure.mgmt.automation.operations.ActivityOperations.list_by_module": "Microsoft.Automation.Modules.listByModule", + "azure.mgmt.automation.aio.operations.ActivityOperations.list_by_module": "Microsoft.Automation.Modules.listByModule", + "azure.mgmt.automation.operations.FieldsOperations.list_by_type": "Microsoft.Automation.Modules.listByType", + "azure.mgmt.automation.aio.operations.FieldsOperations.list_by_type": "Microsoft.Automation.Modules.listByType", + "azure.mgmt.automation.operations.PackageOperations.get": "Microsoft.Automation.Packages.get", + "azure.mgmt.automation.aio.operations.PackageOperations.get": "Microsoft.Automation.Packages.get", + "azure.mgmt.automation.operations.PackageOperations.create_or_update": "Microsoft.Automation.Packages.createOrUpdate", + "azure.mgmt.automation.aio.operations.PackageOperations.create_or_update": "Microsoft.Automation.Packages.createOrUpdate", + "azure.mgmt.automation.operations.PackageOperations.update": "Microsoft.Automation.Packages.update", + "azure.mgmt.automation.aio.operations.PackageOperations.update": "Microsoft.Automation.Packages.update", + "azure.mgmt.automation.operations.PackageOperations.delete": "Microsoft.Automation.Packages.delete", + "azure.mgmt.automation.aio.operations.PackageOperations.delete": "Microsoft.Automation.Packages.delete", + "azure.mgmt.automation.operations.PackageOperations.list_by_runtime_environment": "Microsoft.Automation.Packages.listByRuntimeEnvironment", + "azure.mgmt.automation.aio.operations.PackageOperations.list_by_runtime_environment": "Microsoft.Automation.Packages.listByRuntimeEnvironment", + "azure.mgmt.automation.operations.RunbookOperations.get": "Microsoft.Automation.Runbooks.get", + "azure.mgmt.automation.aio.operations.RunbookOperations.get": "Microsoft.Automation.Runbooks.get", + "azure.mgmt.automation.operations.RunbookOperations.create_or_update": "Microsoft.Automation.Runbooks.createOrUpdate", + "azure.mgmt.automation.aio.operations.RunbookOperations.create_or_update": "Microsoft.Automation.Runbooks.createOrUpdate", + "azure.mgmt.automation.operations.RunbookOperations.update": "Microsoft.Automation.Runbooks.update", + "azure.mgmt.automation.aio.operations.RunbookOperations.update": "Microsoft.Automation.Runbooks.update", + "azure.mgmt.automation.operations.RunbookOperations.delete": "Microsoft.Automation.Runbooks.delete", + "azure.mgmt.automation.aio.operations.RunbookOperations.delete": "Microsoft.Automation.Runbooks.delete", + "azure.mgmt.automation.operations.RunbookOperations.list_by_automation_account": "Microsoft.Automation.Runbooks.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.RunbookOperations.list_by_automation_account": "Microsoft.Automation.Runbooks.listByAutomationAccount", + "azure.mgmt.automation.operations.RunbookOperations.begin_publish": "Microsoft.Automation.Runbooks.publish", + "azure.mgmt.automation.aio.operations.RunbookOperations.begin_publish": "Microsoft.Automation.Runbooks.publish", + "azure.mgmt.automation.operations.RunbookOperations.get_content": "Microsoft.Automation.Runbooks.runbookGetContent", + "azure.mgmt.automation.aio.operations.RunbookOperations.get_content": "Microsoft.Automation.Runbooks.runbookGetContent", + "azure.mgmt.automation.operations.RunbookDraftOperations.get_content": "Microsoft.Automation.Runbooks.getContent", + "azure.mgmt.automation.aio.operations.RunbookDraftOperations.get_content": "Microsoft.Automation.Runbooks.getContent", + "azure.mgmt.automation.operations.RunbookDraftOperations.begin_replace_content": "Microsoft.Automation.Runbooks.replaceContent", + "azure.mgmt.automation.aio.operations.RunbookDraftOperations.begin_replace_content": "Microsoft.Automation.Runbooks.replaceContent", + "azure.mgmt.automation.operations.RunbookDraftOperations.get": "Microsoft.Automation.Runbooks.runbookDraftGet", + "azure.mgmt.automation.aio.operations.RunbookDraftOperations.get": "Microsoft.Automation.Runbooks.runbookDraftGet", + "azure.mgmt.automation.operations.RunbookDraftOperations.undo_edit": "Microsoft.Automation.Runbooks.undoEdit", + "azure.mgmt.automation.aio.operations.RunbookDraftOperations.undo_edit": "Microsoft.Automation.Runbooks.undoEdit", + "azure.mgmt.automation.operations.TestJobStreamsOperations.get": "Microsoft.Automation.Runbooks.testJobStreamsGet", + "azure.mgmt.automation.aio.operations.TestJobStreamsOperations.get": "Microsoft.Automation.Runbooks.testJobStreamsGet", + "azure.mgmt.automation.operations.TestJobStreamsOperations.list_by_test_job": "Microsoft.Automation.Runbooks.listByTestJob", + "azure.mgmt.automation.aio.operations.TestJobStreamsOperations.list_by_test_job": "Microsoft.Automation.Runbooks.listByTestJob", + "azure.mgmt.automation.operations.TestJobOperations.create": "Microsoft.Automation.Runbooks.create", + "azure.mgmt.automation.aio.operations.TestJobOperations.create": "Microsoft.Automation.Runbooks.create", + "azure.mgmt.automation.operations.TestJobOperations.get": "Microsoft.Automation.Runbooks.testJobGet", + "azure.mgmt.automation.aio.operations.TestJobOperations.get": "Microsoft.Automation.Runbooks.testJobGet", + "azure.mgmt.automation.operations.TestJobOperations.resume": "Microsoft.Automation.Runbooks.resume", + "azure.mgmt.automation.aio.operations.TestJobOperations.resume": "Microsoft.Automation.Runbooks.resume", + "azure.mgmt.automation.operations.TestJobOperations.stop": "Microsoft.Automation.Runbooks.stop", + "azure.mgmt.automation.aio.operations.TestJobOperations.stop": "Microsoft.Automation.Runbooks.stop", + "azure.mgmt.automation.operations.TestJobOperations.suspend": "Microsoft.Automation.Runbooks.suspend", + "azure.mgmt.automation.aio.operations.TestJobOperations.suspend": "Microsoft.Automation.Runbooks.suspend", + "azure.mgmt.automation.operations.ScheduleOperations.get": "Microsoft.Automation.Schedules.get", + "azure.mgmt.automation.aio.operations.ScheduleOperations.get": "Microsoft.Automation.Schedules.get", + "azure.mgmt.automation.operations.ScheduleOperations.create_or_update": "Microsoft.Automation.Schedules.createOrUpdate", + "azure.mgmt.automation.aio.operations.ScheduleOperations.create_or_update": "Microsoft.Automation.Schedules.createOrUpdate", + "azure.mgmt.automation.operations.ScheduleOperations.update": "Microsoft.Automation.Schedules.update", + "azure.mgmt.automation.aio.operations.ScheduleOperations.update": "Microsoft.Automation.Schedules.update", + "azure.mgmt.automation.operations.ScheduleOperations.delete": "Microsoft.Automation.Schedules.delete", + "azure.mgmt.automation.aio.operations.ScheduleOperations.delete": "Microsoft.Automation.Schedules.delete", + "azure.mgmt.automation.operations.ScheduleOperations.list_by_automation_account": "Microsoft.Automation.Schedules.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.ScheduleOperations.list_by_automation_account": "Microsoft.Automation.Schedules.listByAutomationAccount", + "azure.mgmt.automation.operations.SourceControlOperations.get": "Microsoft.Automation.SourceControls.get", + "azure.mgmt.automation.aio.operations.SourceControlOperations.get": "Microsoft.Automation.SourceControls.get", + "azure.mgmt.automation.operations.SourceControlOperations.create_or_update": "Microsoft.Automation.SourceControls.createOrUpdate", + "azure.mgmt.automation.aio.operations.SourceControlOperations.create_or_update": "Microsoft.Automation.SourceControls.createOrUpdate", + "azure.mgmt.automation.operations.SourceControlOperations.update": "Microsoft.Automation.SourceControls.update", + "azure.mgmt.automation.aio.operations.SourceControlOperations.update": "Microsoft.Automation.SourceControls.update", + "azure.mgmt.automation.operations.SourceControlOperations.delete": "Microsoft.Automation.SourceControls.delete", + "azure.mgmt.automation.aio.operations.SourceControlOperations.delete": "Microsoft.Automation.SourceControls.delete", + "azure.mgmt.automation.operations.SourceControlOperations.list_by_automation_account": "Microsoft.Automation.SourceControls.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.SourceControlOperations.list_by_automation_account": "Microsoft.Automation.SourceControls.listByAutomationAccount", + "azure.mgmt.automation.operations.SourceControlSyncJobOperations.create": "Microsoft.Automation.SourceControls.create", + "azure.mgmt.automation.aio.operations.SourceControlSyncJobOperations.create": "Microsoft.Automation.SourceControls.create", + "azure.mgmt.automation.operations.SourceControlSyncJobOperations.get": "Microsoft.Automation.SourceControls.sourceControlSyncJobGet", + "azure.mgmt.automation.aio.operations.SourceControlSyncJobOperations.get": "Microsoft.Automation.SourceControls.sourceControlSyncJobGet", + "azure.mgmt.automation.operations.SourceControlSyncJobOperations.list_by_automation_account": "Microsoft.Automation.SourceControls.sourceControlSyncJobListByAutomationAccount", + "azure.mgmt.automation.aio.operations.SourceControlSyncJobOperations.list_by_automation_account": "Microsoft.Automation.SourceControls.sourceControlSyncJobListByAutomationAccount", + "azure.mgmt.automation.operations.SourceControlSyncJobStreamsOperations.list_by_sync_job": "Microsoft.Automation.SourceControls.listBySyncJob", + "azure.mgmt.automation.aio.operations.SourceControlSyncJobStreamsOperations.list_by_sync_job": "Microsoft.Automation.SourceControls.listBySyncJob", + "azure.mgmt.automation.operations.SourceControlSyncJobStreamsOperations.get": "Microsoft.Automation.SourceControls.sourceControlSyncJobStreamsGet", + "azure.mgmt.automation.aio.operations.SourceControlSyncJobStreamsOperations.get": "Microsoft.Automation.SourceControls.sourceControlSyncJobStreamsGet", + "azure.mgmt.automation.operations.VariableOperations.get": "Microsoft.Automation.Variables.get", + "azure.mgmt.automation.aio.operations.VariableOperations.get": "Microsoft.Automation.Variables.get", + "azure.mgmt.automation.operations.VariableOperations.create_or_update": "Microsoft.Automation.Variables.createOrUpdate", + "azure.mgmt.automation.aio.operations.VariableOperations.create_or_update": "Microsoft.Automation.Variables.createOrUpdate", + "azure.mgmt.automation.operations.VariableOperations.update": "Microsoft.Automation.Variables.update", + "azure.mgmt.automation.aio.operations.VariableOperations.update": "Microsoft.Automation.Variables.update", + "azure.mgmt.automation.operations.VariableOperations.delete": "Microsoft.Automation.Variables.delete", + "azure.mgmt.automation.aio.operations.VariableOperations.delete": "Microsoft.Automation.Variables.delete", + "azure.mgmt.automation.operations.VariableOperations.list_by_automation_account": "Microsoft.Automation.Variables.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.VariableOperations.list_by_automation_account": "Microsoft.Automation.Variables.listByAutomationAccount", + "azure.mgmt.automation.operations.WatcherOperations.get": "Microsoft.Automation.Watchers.get", + "azure.mgmt.automation.aio.operations.WatcherOperations.get": "Microsoft.Automation.Watchers.get", + "azure.mgmt.automation.operations.WatcherOperations.create_or_update": "Microsoft.Automation.Watchers.createOrUpdate", + "azure.mgmt.automation.aio.operations.WatcherOperations.create_or_update": "Microsoft.Automation.Watchers.createOrUpdate", + "azure.mgmt.automation.operations.WatcherOperations.update": "Microsoft.Automation.Watchers.update", + "azure.mgmt.automation.aio.operations.WatcherOperations.update": "Microsoft.Automation.Watchers.update", + "azure.mgmt.automation.operations.WatcherOperations.delete": "Microsoft.Automation.Watchers.delete", + "azure.mgmt.automation.aio.operations.WatcherOperations.delete": "Microsoft.Automation.Watchers.delete", + "azure.mgmt.automation.operations.WatcherOperations.list_by_automation_account": "Microsoft.Automation.Watchers.listByAutomationAccount", + "azure.mgmt.automation.aio.operations.WatcherOperations.list_by_automation_account": "Microsoft.Automation.Watchers.listByAutomationAccount", + "azure.mgmt.automation.operations.WatcherOperations.start": "Microsoft.Automation.Watchers.start", + "azure.mgmt.automation.aio.operations.WatcherOperations.start": "Microsoft.Automation.Watchers.start", + "azure.mgmt.automation.operations.WatcherOperations.stop": "Microsoft.Automation.Watchers.stop", + "azure.mgmt.automation.aio.operations.WatcherOperations.stop": "Microsoft.Automation.Watchers.stop", + "azure.mgmt.automation.operations.DeletedAutomationAccountsOperations.list_by_subscription": "Microsoft.Automation.deletedAutomationAccountsOperationGroup.listBySubscription", + "azure.mgmt.automation.aio.operations.DeletedAutomationAccountsOperations.list_by_subscription": "Microsoft.Automation.deletedAutomationAccountsOperationGroup.listBySubscription", + "azure.mgmt.automation.AutomationClient.convert_graph_runbook_content": "Microsoft.Automation.AutomationAccounts.convertGraphRunbookContent", + "azure.mgmt.automation.aio.AutomationClient.convert_graph_runbook_content": "Microsoft.Automation.AutomationAccounts.convertGraphRunbookContent" + }, + "CrossLanguageVersion": "116ee7f83135" } \ No newline at end of file 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 ed517639ae29..e75ca8d0e14f 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/__init__.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._automation_client import AutomationClient # type: ignore +from ._client import AutomationClient # type: ignore from ._version import VERSION __version__ = VERSION diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_automation_client.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_client.py similarity index 81% rename from sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_automation_client.py rename to sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_client.py index 42ddd75c9ac5..5723c96a29f4 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_automation_client.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_client.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from copy import deepcopy +import sys 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 @@ -17,7 +17,6 @@ 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 ._utils.serialization import Deserializer, Serializer from .operations import ( @@ -28,13 +27,13 @@ ConnectionOperations, ConnectionTypeOperations, CredentialOperations, - DscCompilationJobOperations, - DscCompilationJobStreamOperations, + DeletedAutomationAccountsOperations, DscConfigurationOperations, DscNodeConfigurationOperations, DscNodeOperations, FieldsOperations, HybridRunbookWorkerGroupOperations, + HybridRunbookWorkersOperations, JobOperations, JobScheduleOperations, JobStreamOperations, @@ -45,9 +44,14 @@ NodeReportsOperations, ObjectDataTypesOperations, Operations, + PackageOperations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, Python2PackageOperations, + Python3PackageOperations, RunbookDraftOperations, RunbookOperations, + RuntimeEnvironmentsOperations, ScheduleOperations, SoftwareUpdateConfigurationMachineRunsOperations, SoftwareUpdateConfigurationRunsOperations, @@ -62,26 +66,75 @@ VariableOperations, WatcherOperations, WebhookOperations, + _AutomationClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class AutomationClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class AutomationClient(_AutomationClientOperationsMixin): # pylint: disable=too-many-instance-attributes """Automation Client. - :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 software_update_configurations: SoftwareUpdateConfigurationsOperations operations + :vartype software_update_configurations: + azure.mgmt.automation.operations.SoftwareUpdateConfigurationsOperations + :ivar hybrid_runbook_workers: HybridRunbookWorkersOperations operations + :vartype hybrid_runbook_workers: + azure.mgmt.automation.operations.HybridRunbookWorkersOperations + :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 runtime_environments: RuntimeEnvironmentsOperations operations + :vartype runtime_environments: azure.mgmt.automation.operations.RuntimeEnvironmentsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.automation.operations.PrivateEndpointConnectionsOperations + :ivar automation_account: AutomationAccountOperations operations + :vartype automation_account: azure.mgmt.automation.operations.AutomationAccountOperations + :ivar node_count_information: NodeCountInformationOperations operations + :vartype node_count_information: + azure.mgmt.automation.operations.NodeCountInformationOperations + :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 statistics: StatisticsOperations operations :vartype statistics: azure.mgmt.automation.operations.StatisticsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.automation.operations.UsagesOperations :ivar keys: KeysOperations operations :vartype keys: azure.mgmt.automation.operations.KeysOperations + :ivar job: JobOperations operations + :vartype job: azure.mgmt.automation.operations.JobOperations + :ivar linked_workspace: LinkedWorkspaceOperations operations + :vartype linked_workspace: azure.mgmt.automation.operations.LinkedWorkspaceOperations + :ivar object_data_types: ObjectDataTypesOperations operations + :vartype object_data_types: azure.mgmt.automation.operations.ObjectDataTypesOperations + :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 webhook: WebhookOperations operations + :vartype webhook: azure.mgmt.automation.operations.WebhookOperations + :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 certificate: CertificateOperations operations :vartype certificate: azure.mgmt.automation.operations.CertificateOperations :ivar connection: ConnectionOperations operations @@ -92,39 +145,34 @@ class AutomationClient: # pylint: disable=client-accepts-api-version-keyword,to :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_worker_group: HybridRunbookWorkerGroupOperations operations :vartype hybrid_runbook_worker_group: azure.mgmt.automation.operations.HybridRunbookWorkerGroupOperations + :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 - :vartype linked_workspace: azure.mgmt.automation.operations.LinkedWorkspaceOperations - :ivar activity: ActivityOperations operations - :vartype activity: azure.mgmt.automation.operations.ActivityOperations :ivar module: ModuleOperations operations :vartype module: azure.mgmt.automation.operations.ModuleOperations - :ivar object_data_types: ObjectDataTypesOperations operations - :vartype object_data_types: azure.mgmt.automation.operations.ObjectDataTypesOperations + :ivar activity: ActivityOperations operations + :vartype activity: azure.mgmt.automation.operations.ActivityOperations :ivar fields: FieldsOperations operations :vartype fields: azure.mgmt.automation.operations.FieldsOperations + :ivar package: PackageOperations operations + :vartype package: azure.mgmt.automation.operations.PackageOperations + :ivar runbook: RunbookOperations operations + :vartype runbook: azure.mgmt.automation.operations.RunbookOperations + :ivar runbook_draft: RunbookDraftOperations operations + :vartype runbook_draft: azure.mgmt.automation.operations.RunbookDraftOperations + :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 source_control: SourceControlOperations operations :vartype source_control: azure.mgmt.automation.operations.SourceControlOperations :ivar source_control_sync_job: SourceControlSyncJobOperations operations @@ -133,48 +181,26 @@ class AutomationClient: # pylint: disable=client-accepts-api-version-keyword,to :ivar source_control_sync_job_streams: SourceControlSyncJobStreamsOperations operations :vartype source_control_sync_job_streams: azure.mgmt.automation.operations.SourceControlSyncJobStreamsOperations - :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. + :ivar variable: VariableOperations operations + :vartype variable: azure.mgmt.automation.operations.VariableOperations + :ivar watcher: WatcherOperations operations + :vartype watcher: azure.mgmt.automation.operations.WatcherOperations + :ivar deleted_automation_accounts: DeletedAutomationAccountsOperations operations + :vartype deleted_automation_accounts: + azure.mgmt.automation.operations.DeletedAutomationAccountsOperations + :param credential: Credential used to authenticate requests to the service. 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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. 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 api_version: The API version to use for this operation. Known values are "2024-10-23" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -188,6 +214,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: @@ -196,6 +223,7 @@ def __init__( self._config = AutomationClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -219,91 +247,101 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), 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 = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.automation_account = AutomationAccountOperations( + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.software_update_configurations = SoftwareUpdateConfigurationsOperations( 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) - self.certificate = CertificateOperations(self._client, self._config, self._serialize, self._deserialize) - self.connection = ConnectionOperations(self._client, self._config, self._serialize, self._deserialize) - self.connection_type = ConnectionTypeOperations(self._client, self._config, self._serialize, self._deserialize) - self.credential = CredentialOperations(self._client, self._config, self._serialize, self._deserialize) - self.dsc_configuration = DscConfigurationOperations( + self.hybrid_runbook_workers = HybridRunbookWorkersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.hybrid_runbook_worker_group = HybridRunbookWorkerGroupOperations( + 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.runtime_environments = RuntimeEnvironmentsOperations( 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.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.activity = ActivityOperations(self._client, self._config, self._serialize, self._deserialize) - self.module = ModuleOperations(self._client, self._config, self._serialize, self._deserialize) - self.object_data_types = ObjectDataTypesOperations( + self.automation_account = AutomationAccountOperations( self._client, self._config, self._serialize, self._deserialize ) - self.fields = FieldsOperations(self._client, self._config, self._serialize, self._deserialize) - self.schedule = ScheduleOperations(self._client, self._config, self._serialize, self._deserialize) - 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.node_count_information = NodeCountInformationOperations( self._client, self._config, self._serialize, self._deserialize ) - self.software_update_configuration_runs = SoftwareUpdateConfigurationRunsOperations( + self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.software_update_configuration_machine_runs = SoftwareUpdateConfigurationMachineRunsOperations( + self.agent_registration_information = AgentRegistrationInformationOperations( 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.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) + self.job = JobOperations(self._client, self._config, self._serialize, self._deserialize) + self.linked_workspace = LinkedWorkspaceOperations( self._client, self._config, self._serialize, self._deserialize ) - self.source_control_sync_job_streams = SourceControlSyncJobStreamsOperations( + self.object_data_types = ObjectDataTypesOperations( 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.software_update_configuration_machine_runs = SoftwareUpdateConfigurationMachineRunsOperations( 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.software_update_configuration_runs = SoftwareUpdateConfigurationRunsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.dsc_compilation_job_stream = DscCompilationJobStreamOperations( + self.webhook = WebhookOperations(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.certificate = CertificateOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection = ConnectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_type = ConnectionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.credential = CredentialOperations(self._client, self._config, self._serialize, self._deserialize) + 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.node_count_information = NodeCountInformationOperations( + self.hybrid_runbook_worker_group = HybridRunbookWorkerGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.runbook_draft = RunbookDraftOperations(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.module = ModuleOperations(self._client, self._config, self._serialize, self._deserialize) + self.activity = ActivityOperations(self._client, self._config, self._serialize, self._deserialize) + self.fields = FieldsOperations(self._client, self._config, self._serialize, self._deserialize) + self.package = PackageOperations(self._client, self._config, self._serialize, self._deserialize) self.runbook = RunbookOperations(self._client, self._config, self._serialize, self._deserialize) + self.runbook_draft = RunbookDraftOperations(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) + self.schedule = ScheduleOperations(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 + ) + 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.watcher = WatcherOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_automation_accounts = DeletedAutomationAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = client._send_request(request) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -316,7 +354,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: 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 e9f1d22e2592..135eb62bfcad 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_configuration.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -24,23 +24,31 @@ class AutomationClientConfiguration: # pylint: disable=too-many-instance-attrib Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. 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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are "2024-10-23" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, credential: "TokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + api_version: str = kwargs.pop("api_version", "2024-10-23") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -48,7 +56,9 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting + self.api_version = api_version 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 49900f6ab120..ea765788358a 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_patch.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_patch.py @@ -1,15 +1,14 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): 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 index 0af9b28f6607..8026245c2abc 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/__init__.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/__init__.py @@ -1,6 +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. +# Code generated by Microsoft (R) Python 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/_utils/model_base.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/model_base.py new file mode 100644 index 000000000000..bd5b9caf1022 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/model_base.py @@ -0,0 +1,1755 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null + +from azure.core.rest import HttpResponse + +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") +_NONE_TYPE = type(None) + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_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_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + +_ARRAY_ENCODE_MAPPING = { + "pipeDelimited": "|", + "spaceDelimited": " ", + "commaDelimited": ",", + "newlineDelimited": "\n", +} + + +def _deserialize_array_encoded(delimit: str, attr): + if isinstance(attr, str): + if attr == "": + return [] + return attr.split(delimit) + return attr + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj # type: ignore[no-any-return] + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) # type: ignore[no-any-return] + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: + return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + # If this key has been deserialized (for mutable types), we need to handle serialization + if hasattr(self, "_attr_to_rest_field"): + cache_attr = f"_deserialized_{key}" + if hasattr(self, cache_attr): + rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) + if rf: + value = self._data.get(key) + if isinstance(value, (dict, list, set)): + # For mutable types, serialize and return + # But also update _data with serialized form and clear flag + # so mutations via this returned value affect _data + serialized = _serialize(value, rf._format) + # If serialized form is same type (no transformation needed), + # return _data directly so mutations work + if isinstance(serialized, type(value)) and serialized == value: + return self._data.get(key) + # Otherwise return serialized copy and clear flag + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + # Store serialized form back + self._data[key] = serialized + return serialized + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + # Clear any cached deserialized value when setting through dictionary access + cache_attr = f"_deserialized_{key}" + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): + return _ARRAY_ENCODE_MAPPING[format].join(o) + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +# ============================================================================ +# Fast-path scalar deserializer functions for rest_field(deserializer=...) +# These are referenced from rest_field declarations to bypass the generic +# _deserialize -> _deserialize_with_callable chain. +# Only simple/primitive types — no models or container types. +# ============================================================================ + + +def _xml_deser_str(value): + if isinstance(value, ET.Element): + return value.text or "" + return str(value) if value is not None else None + + +def _xml_deser_int(value): + if isinstance(value, ET.Element): + return int(value.text) if value.text else None + return int(value) if value is not None else None + + +def _xml_deser_float(value): + if isinstance(value, ET.Element): + return float(value.text) if value.text else None + return float(value) if value is not None else None + + +def _xml_deser_bool(value): + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + if text in (True, False): + return text + return text.lower() == "true" + + +# pylint: disable=docstring-missing-param +def _xml_deser_bytes(value): + """Deserialize bytes from XML (base64).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes(text) + + +def _xml_deser_bytes_base64url(value): + """Deserialize bytes from XML (base64url).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes_base64(text) + + +def _xml_deser_datetime(value): + """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime(text) + + +def _xml_deser_datetime_rfc7231(value): + """Deserialize a datetime from XML (RFC7231 format).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_rfc7231(text) + + +def _xml_deser_datetime_unix_timestamp(value): + """Deserialize a datetime from XML (Unix timestamp).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_unix_timestamp(float(text)) + + +def _xml_deser_date(value): + """Deserialize a date from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_date(text) + + +def _xml_deser_time(value): + """Deserialize a time from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_time(text) + + +def _xml_deser_duration(value): + """Deserialize a timedelta from XML (ISO 8601 duration).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_duration(text) + + +def _xml_deser_decimal(value): + """Deserialize a Decimal from XML.""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_decimal(text) + + +def _xml_deser_enum_or_str(enum_cls, value): + """Deserialize a Union[EnumType, str] from XML.""" + text = value.text if isinstance(value, ET.Element) else value + if text is None: + return None + try: + return enum_cls(text) + except ValueError: + return text + + +def _extract_xml_model_type(rf_type): + """Extract the concrete Model class from a resolved rf._type partial chain. + + Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` + wrappers. Only handles Model and Optional[Model] — other composite + types (List, Dict, Union, etc.) return None and fall through to the + generic ``_deserialize`` path at runtime. + """ + if rf_type is None: + return None + if isinstance(rf_type, type) and _is_model(rf_type): + return rf_type + if not isinstance(rf_type, functools.partial): + return None + func = rf_type.func + args = rf_type.args + if func is _deserialize_with_optional and args: + return _extract_xml_model_type(args[0]) + if func is _deserialize_model and args: + cls = args[0] + return cls if isinstance(cls, type) and _is_model(cls) else None + return None + + +def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable + cls, attr_to_rest_field: dict +) -> list: + """Build a precomputed XML field plan for fast _init_from_xml iteration. + + Called once per model class in __new__. Returns a list of tuples: + (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) + + kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text + + For Model and Optional[Model] fields that lack a scalar + ``_deserializer``, this function precomputes the Model class as the + deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` + directly instead of going through the expensive + ``_get_deserialize_callable_from_annotation`` chain at runtime. + """ + model_meta = getattr(cls, "_xml", {}) + model_ns = model_meta.get("ns") or model_meta.get("namespace") + plan = [] + + for rf in attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + deser = rf._deserializer + + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + is_optional = rf._is_optional + + # For Model / Optional[Model] fields without a scalar deserializer, + # precompute the Model class as the deserializer. + if deser is None and rf._type is not None: + model_cls = _extract_xml_model_type(rf._type) + if model_cls is not None: + deser = model_cls + + if prop_meta.get("attribute", False): + plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) + elif prop_meta.get("unwrapped", False): + items_name = prop_meta.get("itemsName") + if items_name: + items_ns = prop_meta.get("itemsNs") + if items_ns is not None: + xml_ns = items_ns + if xml_ns: + items_name = "{" + xml_ns + "}" + items_name + else: + items_name = xml_name + plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) + elif prop_meta.get("text", False): + plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) + else: + plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) + + return plan + + +# pylint: enable=docstring-missing-param +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass: dict[str, typing.Any] = {} + if args: + if isinstance(args[0], ET.Element): + dict_to_pass.update(self._init_from_xml(args[0])) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + # Apply client default values for fields the caller didn't set so that + # defaults are part of `_data` and therefore included during serialization. + for rf in self._attr_to_rest_field.values(): + if rf._default is _UNSET: + continue + if rf._rest_name in dict_to_pass: + continue + dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) + super().__init__(dict_to_pass) + + def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements + self, element: ET.Element + ) -> dict[str, typing.Any]: + """Deserialize an XML element into a dict mapping rest field names to values. + + :param ET.Element element: The XML element to deserialize from. + :returns: A dictionary of rest_name to deserialized value pairs. + :rtype: dict + """ + result: dict[str, typing.Any] = {} + existed_attr_keys: list[str] = [] + + field_plan = getattr(self, "_xml_field_plan", None) + if field_plan: + for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: + if kind == 0: # wrapped element (most common) + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(item) + else: + result[rest_name] = _deserialize(rf_type, item) + elif kind == 1: # attribute + attr_val = element.get(xml_name) + if attr_val is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(attr_val) + else: + result[rest_name] = attr_val + elif kind == 2: # unwrapped array + items = element.findall(items_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(items_name) + if deser: + result[rest_name] = deser(items) + else: + result[rest_name] = _deserialize(rf_type, items) + elif not is_optional: + existed_attr_keys.append(items_name) + result[rest_name] = [] + elif kind == 3: # text + if element.text is not None: + if deser: + result[rest_name] = deser(element.text) + else: + result[rest_name] = element.text + else: + model_meta = getattr(self, "_xml", {}) + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in element: + if e.tag not in existed_attr_keys: + result[e.tag] = _convert_element(e) + + return result + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._backcompat_attr_to_rest_field: dict[str, _RestField] = { + Model._get_backcompat_attribute_name(cls._attr_to_rest_field, attr): rf + for attr, rf in cls._attr_to_rest_field.items() + } + # Build XML field plan for fast _init_from_xml (only for XML models) + if getattr(cls, "_xml", None): + cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_backcompat_attribute_name(cls, attr_to_rest_field: dict[str, "_RestField"], attr_name: str) -> str: + rest_field_obj = attr_to_rest_field.get(attr_name) # pylint: disable=protected-access + if rest_field_obj is None: + return attr_name + original_tsp_name = getattr(rest_field_obj, "_original_tsp_name", None) # pylint: disable=protected-access + if original_tsp_name: + return original_tsp_name + return attr_name + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: list[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: + return ( + isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + + # encoded string may be deserialized to sequence + if isinstance(obj, str) and isinstance(deserializer, functools.partial): + # for list[str] + if _is_array_encoded_deserializer(deserializer): + return deserializer(obj) + + # for list[Union[...]] + if isinstance(deserializer.args[0], list): + for sub_deserializer in deserializer.args[0]: + if _is_array_encoded_deserializer(sub_deserializer): + return sub_deserializer(obj) + + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value.text if isinstance(value, ET.Element) else value) + except ValueError: + # for unknown value, return raw value + return value.text if isinstance(value, ET.Element) else value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +# pylint: disable=too-many-instance-attributes +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, + original_tsp_name: typing.Optional[str] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._is_optional = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + self._deserializer = deserializer + self._original_tsp_name = original_tsp_name + + @property + def _class_type(self) -> typing.Any: + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + # Use _data.get() directly to avoid triggering __getitem__ which clears the cache + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None + if item is None: + return item + if self._is_model: + return item + + # For mutable types, we want mutations to directly affect _data + # Check if we've already deserialized this value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + # Return the value from _data directly (it's been deserialized in place) + return obj._data.get(self._rest_name) + + # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) + if self._deserializer: + deserialized = self._deserializer(item) + else: + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, store the deserialized value back in _data + # so mutations directly affect _data + if isinstance(deserialized, (dict, list, set)): + obj._data[self._rest_name] = deserialized + object.__setattr__(obj, cache_attr, True) # Mark as deserialized + return deserialized + + return deserialized + + def __set__(self, obj: Model, value) -> None: + # Clear the cached deserialized object when setting a new value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + object.__delattr__(obj, cache_attr) + + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, + original_tsp_name: typing.Optional[str] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + deserializer=deserializer, + original_tsp_name=original_tsp_name, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: + """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. + + :param dict meta: The metadata dictionary to extract namespace from. + :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. + :rtype: str or None + """ + ns = meta.get("ns") + if ns is None: + ns = meta.get("namespace") + return ns + + +def _resolve_xml_ns( + prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None +) -> typing.Optional[str]: + """Resolve XML namespace for a property, falling back to model namespace when appropriate. + + Checks the property metadata first; if no namespace is found and the model does not declare + an explicit prefix, falls back to the model-level namespace. + + :param dict prop_meta: The property metadata dictionary. + :param dict model_meta: The model metadata dictionary, used as fallback. + :returns: The resolved namespace string, or None. + :rtype: str or None + """ + ns = _get_xml_ns(prop_meta) + if ns is None and model_meta is not None and not model_meta.get("prefix"): + ns = _get_xml_ns(model_meta) + return ns + + +def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: + """Set an XML attribute on an element, handling namespace prefix registration. + + :param ET.Element element: The element to set the attribute on. + :param str name: The default attribute name (wire name). + :param any value: The attribute value. + :param dict prop_meta: The property metadata dictionary. + """ + xml_name = prop_meta.get("name", name) + _attr_ns = _get_xml_ns(prop_meta) + if _attr_ns: + _attr_prefix = prop_meta.get("prefix") + if _attr_prefix: + _safe_register_namespace(_attr_prefix, _attr_ns) + xml_name = "{" + _attr_ns + "}" + xml_name + element.set(xml_name, _get_primitive_type_value(value)) + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, list[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + # When serializing as an array item (parent_meta is set), check if the parent has an + # explicit itemsName. This ensures correct element names for unwrapped arrays (where + # the element tag is the property/items name, not the model type name). + _items_name = parent_meta.get("itemsName") if parent_meta is not None else None + element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) + _model_ns = _get_xml_ns(model_meta) + wrapped_element = _create_xml_element( + element_name, + model_meta.get("prefix"), + _model_ns, + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # Propagate model namespace to properties only for old-style "ns"-keyed models. + # DPG-generated models use the "namespace" key and explicitly declare namespace on + # each property that needs it, so propagation is intentionally skipped for them. + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + _set_xml_attribute(wrapped_element, k, v, prop_meta) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": _dict_ns, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + _items_ns = parent_meta.get("itemsNs") + if _items_ns is None: + _items_ns = _get_xml_ns(parent_meta) + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": _items_ns, + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + _meta_ns = _get_xml_ns(meta) if meta else None + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element # type: ignore[no-any-return] + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _safe_register_namespace(prefix: str, ns: str) -> None: + """Register an XML namespace prefix, handling reserved prefix patterns. + + Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for + auto-generated prefixes, causing register_namespace to raise ValueError. + Falls back to directly registering in the internal namespace map. + + :param str prefix: The namespace prefix to register. + :param str ns: The namespace URI. + """ + try: + ET.register_namespace(prefix, ns) + except ValueError: + _ns_map = getattr(ET, "_namespace_map", None) + if _ns_map is not None: + _ns_map[ns] = prefix + + +def _create_xml_element( + tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None +) -> ET.Element: + if prefix and ns: + _safe_register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + if _is_model(deserializer): + return deserializer._deserialize(element, []) + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: list[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/serialization.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/serialization.py index 6da830e0cf4a..a088671e9c51 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/serialization.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/serialization.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -39,11 +39,15 @@ 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 +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] @@ -1401,7 +1405,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: # Otherwise, result are unexpected self.additional_properties_detection = True - def __call__(self, target_obj, response_data, content_type=None): + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements """Call the deserializer to process a REST response. :param str target_obj: Target data type to deserialize to. @@ -1411,6 +1415,27 @@ def __call__(self, target_obj, response_data, content_type=None): :return: Deserialized object. :rtype: object """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/utils.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/utils.py new file mode 100644 index 000000000000..35c9c836f85f --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_utils/utils.py @@ -0,0 +1,25 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from abc import ABC +from typing import Generic, TYPE_CHECKING, TypeVar + +if TYPE_CHECKING: + from .serialization import Deserializer, Serializer + + +TClient = TypeVar("TClient") +TConfig = TypeVar("TConfig") + + +class ClientMixinABC(ABC, Generic[TClient, TConfig]): + """DO NOT use this class. It is for internal typing use only.""" + + _client: TClient + _config: TConfig + _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 13fcaff38832..cffb9c489194 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_version.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_version.py @@ -2,9 +2,8 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- - -VERSION = "1.0.1" +VERSION = "1.1.0b5" 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 a019f6ceb932..72ab912d7ed3 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._automation_client import AutomationClient # type: ignore +from ._client import AutomationClient # type: ignore try: from ._patch import __all__ as _patch_all 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/_client.py similarity index 82% rename from sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_automation_client.py rename to sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_client.py index 19b0af2bb01d..501b9cbacaaf 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_automation_client.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_client.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from copy import deepcopy +import sys 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 @@ -17,7 +17,6 @@ from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models from .._utils.serialization import Deserializer, Serializer from ._configuration import AutomationClientConfiguration from .operations import ( @@ -28,13 +27,13 @@ ConnectionOperations, ConnectionTypeOperations, CredentialOperations, - DscCompilationJobOperations, - DscCompilationJobStreamOperations, + DeletedAutomationAccountsOperations, DscConfigurationOperations, DscNodeConfigurationOperations, DscNodeOperations, FieldsOperations, HybridRunbookWorkerGroupOperations, + HybridRunbookWorkersOperations, JobOperations, JobScheduleOperations, JobStreamOperations, @@ -45,9 +44,14 @@ NodeReportsOperations, ObjectDataTypesOperations, Operations, + PackageOperations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, Python2PackageOperations, + Python3PackageOperations, RunbookDraftOperations, RunbookOperations, + RuntimeEnvironmentsOperations, ScheduleOperations, SoftwareUpdateConfigurationMachineRunsOperations, SoftwareUpdateConfigurationRunsOperations, @@ -62,26 +66,76 @@ VariableOperations, WatcherOperations, WebhookOperations, + _AutomationClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class AutomationClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class AutomationClient(_AutomationClientOperationsMixin): # pylint: disable=too-many-instance-attributes """Automation Client. - :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 software_update_configurations: SoftwareUpdateConfigurationsOperations operations + :vartype software_update_configurations: + azure.mgmt.automation.aio.operations.SoftwareUpdateConfigurationsOperations + :ivar hybrid_runbook_workers: HybridRunbookWorkersOperations operations + :vartype hybrid_runbook_workers: + azure.mgmt.automation.aio.operations.HybridRunbookWorkersOperations + :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 runtime_environments: RuntimeEnvironmentsOperations operations + :vartype runtime_environments: + azure.mgmt.automation.aio.operations.RuntimeEnvironmentsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.automation.aio.operations.PrivateEndpointConnectionsOperations + :ivar automation_account: AutomationAccountOperations operations + :vartype automation_account: azure.mgmt.automation.aio.operations.AutomationAccountOperations + :ivar node_count_information: NodeCountInformationOperations operations + :vartype node_count_information: + azure.mgmt.automation.aio.operations.NodeCountInformationOperations + :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 statistics: StatisticsOperations operations :vartype statistics: azure.mgmt.automation.aio.operations.StatisticsOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.automation.aio.operations.UsagesOperations :ivar keys: KeysOperations operations :vartype keys: azure.mgmt.automation.aio.operations.KeysOperations + :ivar job: JobOperations operations + :vartype job: azure.mgmt.automation.aio.operations.JobOperations + :ivar linked_workspace: LinkedWorkspaceOperations operations + :vartype linked_workspace: azure.mgmt.automation.aio.operations.LinkedWorkspaceOperations + :ivar object_data_types: ObjectDataTypesOperations operations + :vartype object_data_types: azure.mgmt.automation.aio.operations.ObjectDataTypesOperations + :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 webhook: WebhookOperations operations + :vartype webhook: azure.mgmt.automation.aio.operations.WebhookOperations + :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 certificate: CertificateOperations operations :vartype certificate: azure.mgmt.automation.aio.operations.CertificateOperations :ivar connection: ConnectionOperations operations @@ -92,39 +146,34 @@ class AutomationClient: # pylint: disable=client-accepts-api-version-keyword,to :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_worker_group: HybridRunbookWorkerGroupOperations operations :vartype hybrid_runbook_worker_group: azure.mgmt.automation.aio.operations.HybridRunbookWorkerGroupOperations + :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 - :vartype linked_workspace: azure.mgmt.automation.aio.operations.LinkedWorkspaceOperations - :ivar activity: ActivityOperations operations - :vartype activity: azure.mgmt.automation.aio.operations.ActivityOperations :ivar module: ModuleOperations operations :vartype module: azure.mgmt.automation.aio.operations.ModuleOperations - :ivar object_data_types: ObjectDataTypesOperations operations - :vartype object_data_types: azure.mgmt.automation.aio.operations.ObjectDataTypesOperations + :ivar activity: ActivityOperations operations + :vartype activity: azure.mgmt.automation.aio.operations.ActivityOperations :ivar fields: FieldsOperations operations :vartype fields: azure.mgmt.automation.aio.operations.FieldsOperations + :ivar package: PackageOperations operations + :vartype package: azure.mgmt.automation.aio.operations.PackageOperations + :ivar runbook: RunbookOperations operations + :vartype runbook: azure.mgmt.automation.aio.operations.RunbookOperations + :ivar runbook_draft: RunbookDraftOperations operations + :vartype runbook_draft: azure.mgmt.automation.aio.operations.RunbookDraftOperations + :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 source_control: SourceControlOperations operations :vartype source_control: azure.mgmt.automation.aio.operations.SourceControlOperations :ivar source_control_sync_job: SourceControlSyncJobOperations operations @@ -133,48 +182,26 @@ class AutomationClient: # pylint: disable=client-accepts-api-version-keyword,to :ivar source_control_sync_job_streams: SourceControlSyncJobStreamsOperations operations :vartype source_control_sync_job_streams: azure.mgmt.automation.aio.operations.SourceControlSyncJobStreamsOperations - :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. + :ivar variable: VariableOperations operations + :vartype variable: azure.mgmt.automation.aio.operations.VariableOperations + :ivar watcher: WatcherOperations operations + :vartype watcher: azure.mgmt.automation.aio.operations.WatcherOperations + :ivar deleted_automation_accounts: DeletedAutomationAccountsOperations operations + :vartype deleted_automation_accounts: + azure.mgmt.automation.aio.operations.DeletedAutomationAccountsOperations + :param credential: Credential used to authenticate requests to the service. 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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. 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 api_version: The API version to use for this operation. Known values are "2024-10-23" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -188,6 +215,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: @@ -196,6 +224,7 @@ def __init__( self._config = AutomationClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -220,86 +249,96 @@ def __init__( self._config.http_logging_policy, ] self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, base_url), policies=_policies, **kwargs + base_url=cast(str, _endpoint), 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 = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.automation_account = AutomationAccountOperations( + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.software_update_configurations = SoftwareUpdateConfigurationsOperations( 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) - self.certificate = CertificateOperations(self._client, self._config, self._serialize, self._deserialize) - self.connection = ConnectionOperations(self._client, self._config, self._serialize, self._deserialize) - self.connection_type = ConnectionTypeOperations(self._client, self._config, self._serialize, self._deserialize) - self.credential = CredentialOperations(self._client, self._config, self._serialize, self._deserialize) - self.dsc_configuration = DscConfigurationOperations( + self.hybrid_runbook_workers = HybridRunbookWorkersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.hybrid_runbook_worker_group = HybridRunbookWorkerGroupOperations( + 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.runtime_environments = RuntimeEnvironmentsOperations( 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.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.activity = ActivityOperations(self._client, self._config, self._serialize, self._deserialize) - self.module = ModuleOperations(self._client, self._config, self._serialize, self._deserialize) - self.object_data_types = ObjectDataTypesOperations( + self.automation_account = AutomationAccountOperations( self._client, self._config, self._serialize, self._deserialize ) - self.fields = FieldsOperations(self._client, self._config, self._serialize, self._deserialize) - self.schedule = ScheduleOperations(self._client, self._config, self._serialize, self._deserialize) - 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.node_count_information = NodeCountInformationOperations( self._client, self._config, self._serialize, self._deserialize ) - self.software_update_configuration_runs = SoftwareUpdateConfigurationRunsOperations( + self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.software_update_configuration_machine_runs = SoftwareUpdateConfigurationMachineRunsOperations( + self.agent_registration_information = AgentRegistrationInformationOperations( 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.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) + self.job = JobOperations(self._client, self._config, self._serialize, self._deserialize) + self.linked_workspace = LinkedWorkspaceOperations( self._client, self._config, self._serialize, self._deserialize ) - self.source_control_sync_job_streams = SourceControlSyncJobStreamsOperations( + self.object_data_types = ObjectDataTypesOperations( 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.software_update_configuration_machine_runs = SoftwareUpdateConfigurationMachineRunsOperations( 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.software_update_configuration_runs = SoftwareUpdateConfigurationRunsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.dsc_compilation_job_stream = DscCompilationJobStreamOperations( + self.webhook = WebhookOperations(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.certificate = CertificateOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection = ConnectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_type = ConnectionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.credential = CredentialOperations(self._client, self._config, self._serialize, self._deserialize) + 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.node_count_information = NodeCountInformationOperations( + self.hybrid_runbook_worker_group = HybridRunbookWorkerGroupOperations( self._client, self._config, self._serialize, self._deserialize ) - self.runbook_draft = RunbookDraftOperations(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.module = ModuleOperations(self._client, self._config, self._serialize, self._deserialize) + self.activity = ActivityOperations(self._client, self._config, self._serialize, self._deserialize) + self.fields = FieldsOperations(self._client, self._config, self._serialize, self._deserialize) + self.package = PackageOperations(self._client, self._config, self._serialize, self._deserialize) self.runbook = RunbookOperations(self._client, self._config, self._serialize, self._deserialize) + self.runbook_draft = RunbookDraftOperations(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) + self.schedule = ScheduleOperations(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 + ) + 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.watcher = WatcherOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_automation_accounts = DeletedAutomationAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request( + def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -307,7 +346,7 @@ def _send_request( >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = await client._send_request(request) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -320,7 +359,11 @@ def _send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: 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 2e88f37b00e1..2d387b6e907c 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -24,23 +24,31 @@ class AutomationClientConfiguration: # pylint: disable=too-many-instance-attrib Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. 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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are "2024-10-23" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + api_version: str = kwargs.pop("api_version", "2024-10-23") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -48,7 +56,9 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting + self.api_version = api_version 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 49900f6ab120..ea765788358a 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 @@ -1,15 +1,14 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): 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 e63de9f02ba2..e02702657b27 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,94 +12,105 @@ 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 ._operations import SoftwareUpdateConfigurationsOperations # type: ignore +from ._operations import HybridRunbookWorkersOperations # type: ignore +from ._operations import Python2PackageOperations # type: ignore +from ._operations import Python3PackageOperations # type: ignore +from ._operations import RuntimeEnvironmentsOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import AutomationAccountOperations # type: ignore +from ._operations import NodeCountInformationOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import AgentRegistrationInformationOperations # type: ignore +from ._operations import StatisticsOperations # type: ignore +from ._operations import UsagesOperations # type: ignore +from ._operations import KeysOperations # type: ignore +from ._operations import JobOperations # type: ignore +from ._operations import LinkedWorkspaceOperations # type: ignore +from ._operations import ObjectDataTypesOperations # type: ignore +from ._operations import SoftwareUpdateConfigurationMachineRunsOperations # type: ignore +from ._operations import SoftwareUpdateConfigurationRunsOperations # type: ignore +from ._operations import WebhookOperations # type: ignore +from ._operations import DscNodeOperations # type: ignore +from ._operations import NodeReportsOperations # type: ignore +from ._operations import CertificateOperations # type: ignore +from ._operations import ConnectionOperations # type: ignore +from ._operations import ConnectionTypeOperations # type: ignore +from ._operations import CredentialOperations # type: ignore +from ._operations import DscConfigurationOperations # type: ignore +from ._operations import DscNodeConfigurationOperations # type: ignore +from ._operations import HybridRunbookWorkerGroupOperations # type: ignore +from ._operations import JobStreamOperations # type: ignore +from ._operations import JobScheduleOperations # type: ignore +from ._operations import ModuleOperations # type: ignore +from ._operations import ActivityOperations # type: ignore +from ._operations import FieldsOperations # type: ignore +from ._operations import PackageOperations # type: ignore +from ._operations import RunbookOperations # type: ignore +from ._operations import RunbookDraftOperations # type: ignore +from ._operations import TestJobStreamsOperations # type: ignore +from ._operations import TestJobOperations # type: ignore +from ._operations import ScheduleOperations # type: ignore +from ._operations import SourceControlOperations # type: ignore +from ._operations import SourceControlSyncJobOperations # type: ignore +from ._operations import SourceControlSyncJobStreamsOperations # type: ignore +from ._operations import VariableOperations # type: ignore +from ._operations import WatcherOperations # type: ignore +from ._operations import DeletedAutomationAccountsOperations # type: ignore +from ._operations import _AutomationClientOperationsMixin # type: ignore # pylint: disable=unused-import from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AutomationAccountOperations", "Operations", + "SoftwareUpdateConfigurationsOperations", + "HybridRunbookWorkersOperations", + "Python2PackageOperations", + "Python3PackageOperations", + "RuntimeEnvironmentsOperations", + "PrivateEndpointConnectionsOperations", + "AutomationAccountOperations", + "NodeCountInformationOperations", + "PrivateLinkResourcesOperations", + "AgentRegistrationInformationOperations", "StatisticsOperations", "UsagesOperations", "KeysOperations", + "JobOperations", + "LinkedWorkspaceOperations", + "ObjectDataTypesOperations", + "SoftwareUpdateConfigurationMachineRunsOperations", + "SoftwareUpdateConfigurationRunsOperations", + "WebhookOperations", + "DscNodeOperations", + "NodeReportsOperations", "CertificateOperations", "ConnectionOperations", "ConnectionTypeOperations", "CredentialOperations", "DscConfigurationOperations", + "DscNodeConfigurationOperations", "HybridRunbookWorkerGroupOperations", + "JobStreamOperations", "JobScheduleOperations", - "LinkedWorkspaceOperations", - "ActivityOperations", "ModuleOperations", - "ObjectDataTypesOperations", + "ActivityOperations", "FieldsOperations", + "PackageOperations", + "RunbookOperations", + "RunbookDraftOperations", + "TestJobStreamsOperations", + "TestJobOperations", "ScheduleOperations", - "VariableOperations", - "WebhookOperations", - "WatcherOperations", - "SoftwareUpdateConfigurationsOperations", - "SoftwareUpdateConfigurationRunsOperations", - "SoftwareUpdateConfigurationMachineRunsOperations", "SourceControlOperations", "SourceControlSyncJobOperations", "SourceControlSyncJobStreamsOperations", - "JobOperations", - "JobStreamOperations", - "AgentRegistrationInformationOperations", - "DscNodeOperations", - "NodeReportsOperations", - "DscCompilationJobOperations", - "DscCompilationJobStreamOperations", - "DscNodeConfigurationOperations", - "NodeCountInformationOperations", - "RunbookDraftOperations", - "RunbookOperations", - "TestJobStreamsOperations", - "TestJobOperations", - "Python2PackageOperations", + "VariableOperations", + "WatcherOperations", + "DeletedAutomationAccountsOperations", ] __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 deleted file mode 100644 index 7d972fd180d6..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_activity_operations.py +++ /dev/null @@ -1,210 +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 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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._activity_operations import build_get_request, build_list_by_module_request -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ActivityOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`activity` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - module_name: str, - activity_name: str, - **kwargs: Any - ) -> _models.Activity: - """Retrieve the activity in the module identified by module name and activity name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/activityoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param activity_name: The name of activity. Required. - :type activity_name: str - :return: Activity or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Activity - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - activity_name=activity_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("Activity", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_module( - self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.Activity"]: - """Retrieve a list of activities in the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/activityoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :return: An iterator like instance of either Activity or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Activity] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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_module_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("ActivityListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_agent_registration_information_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_agent_registration_information_operations.py deleted file mode 100644 index 7aa1f3cd79a8..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_agent_registration_information_operations.py +++ /dev/null @@ -1,258 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -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 ..._utils.serialization import Deserializer, Serializer -from ...operations._agent_registration_information_operations import build_get_request, build_regenerate_key_request -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class AgentRegistrationInformationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`agent_registration_information` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> _models.AgentRegistration: - """Retrieve the automation agent registration information. - - .. seealso:: - - http://aka.ms/azureautomationsdk/agentregistrationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: AgentRegistration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AgentRegistration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) - - _request = build_get_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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_key( - self, - resource_group_name: str, - automation_account_name: str, - parameters: _models.AgentRegistrationRegenerateKeyParameter, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AgentRegistration: - """Regenerate a primary or secondary agent registration key. - - .. seealso:: - - http://aka.ms/azureautomationsdk/agentregistrationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: The name of the agent registration key to be regenerated. Required. - :type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AgentRegistration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AgentRegistration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_key( - self, - resource_group_name: str, - automation_account_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AgentRegistration: - """Regenerate a primary or secondary agent registration key. - - .. seealso:: - - http://aka.ms/azureautomationsdk/agentregistrationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: The name of the agent registration key to be regenerated. 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: AgentRegistration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AgentRegistration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_key( - self, - resource_group_name: str, - automation_account_name: str, - parameters: Union[_models.AgentRegistrationRegenerateKeyParameter, IO[bytes]], - **kwargs: Any - ) -> _models.AgentRegistration: - """Regenerate a primary or secondary agent registration key. - - .. seealso:: - - http://aka.ms/azureautomationsdk/agentregistrationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: The name of the agent registration key to be regenerated. Is either a - AgentRegistrationRegenerateKeyParameter type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter or - IO[bytes] - :return: AgentRegistration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AgentRegistration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AgentRegistrationRegenerateKeyParameter") - - _request = build_regenerate_key_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( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - 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/_automation_account_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_account_operations.py deleted file mode 100644 index f87af3b6d17e..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_account_operations.py +++ /dev/null @@ -1,610 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._automation_account_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class AutomationAccountOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`automation_account` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - parameters: _models.AutomationAccountUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutomationAccount: - """Update an automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: Parameters supplied to the update automation account. Required. - :type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutomationAccount: - """Update an automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: Parameters supplied to the update automation account. 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: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - automation_account_name: str, - parameters: Union[_models.AutomationAccountUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.AutomationAccount: - """Update an automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: Parameters supplied to the update automation account. Is either a - AutomationAccountUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters or IO[bytes] - :return: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AutomationAccountUpdateParameters") - - _request = build_update_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( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - 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, - parameters: _models.AutomationAccountCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutomationAccount: - """Create or update automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: Parameters supplied to the create or update automation account. Required. - :type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutomationAccount: - """Create or update automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: Parameters supplied to the create or update automation account. 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: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - parameters: Union[_models.AutomationAccountCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.AutomationAccount: - """Create or update automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: Parameters supplied to the create or update automation account. Is either a - AutomationAccountCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters or - IO[bytes] - :return: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AutomationAccountCreateOrUpdateParameters") - - _request = build_create_or_update_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( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_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("AutomationAccount", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> None: - """Delete an automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - 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) - - _stream = False - pipeline_response: PipelineResponse = await 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, **kwargs: Any - ) -> _models.AutomationAccount: - """Get information about an Automation Account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.AutomationAccount"]: - """Retrieve a list of accounts within a given resource group. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :return: An iterator like instance of either AutomationAccount or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.AutomationAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("AutomationAccountListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.AutomationAccount"]: - """Lists the Automation Accounts within an Azure subscription. - - Retrieve a list of accounts within a given subscription. - - :return: An iterator like instance of either AutomationAccount or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.AutomationAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("AutomationAccountListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_certificate_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_certificate_operations.py deleted file mode 100644 index 58c0c65179c4..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_certificate_operations.py +++ /dev/null @@ -1,574 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._certificate_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_automation_account_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CertificateOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`certificate` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, certificate_name: str, **kwargs: Any - ) -> None: - """Delete the certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The name of certificate. Required. - :type certificate_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - certificate_name=certificate_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, certificate_name: str, **kwargs: Any - ) -> _models.Certificate: - """Retrieve the certificate identified by certificate name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The name of certificate. Required. - :type certificate_name: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - certificate_name=certificate_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("Certificate", 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, - certificate_name: str, - parameters: _models.CertificateCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Certificate: - """Create a certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The parameters supplied to the create or update certificate operation. - Required. - :type certificate_name: str - :param parameters: The parameters supplied to the create or update certificate operation. - Required. - :type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - certificate_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Certificate: - """Create a certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The parameters supplied to the create or update certificate operation. - Required. - :type certificate_name: str - :param parameters: The parameters supplied to the create or update certificate operation. - 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: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - certificate_name: str, - parameters: Union[_models.CertificateCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Certificate: - """Create a certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The parameters supplied to the create or update certificate operation. - Required. - :type certificate_name: str - :param parameters: The parameters supplied to the create or update certificate operation. Is - either a CertificateCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters or - IO[bytes] - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - certificate_name=certificate_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("Certificate", 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, - certificate_name: str, - parameters: _models.CertificateUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Certificate: - """Update a certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The parameters supplied to the update certificate operation. Required. - :type certificate_name: str - :param parameters: The parameters supplied to the update certificate operation. Required. - :type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - certificate_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Certificate: - """Update a certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The parameters supplied to the update certificate operation. Required. - :type certificate_name: str - :param parameters: The parameters supplied to the update certificate operation. 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: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - automation_account_name: str, - certificate_name: str, - parameters: Union[_models.CertificateUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Certificate: - """Update a certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The parameters supplied to the update certificate operation. Required. - :type certificate_name: str - :param parameters: The parameters supplied to the update certificate operation. Is either a - CertificateUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters or IO[bytes] - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CertificateUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - certificate_name=certificate_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("Certificate", 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 - ) -> AsyncItemPaged["_models.Certificate"]: - """Retrieve a list of certificates. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Certificate or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Certificate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("CertificateListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_connection_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_operations.py deleted file mode 100644 index e5a102438897..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_operations.py +++ /dev/null @@ -1,579 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._connection_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_automation_account_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ConnectionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`connection` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, connection_name: str, **kwargs: Any - ) -> Optional[_models.Connection]: - """Delete the connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The name of connection. Required. - :type connection_name: str - :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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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, - automation_account_name=automation_account_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Connection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, connection_name: str, **kwargs: Any - ) -> _models.Connection: - """Retrieve the connection identified by connection name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The name of connection. Required. - :type connection_name: str - :return: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Connection", 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, - connection_name: str, - parameters: _models.ConnectionCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Connection: - """Create or update a connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The parameters supplied to the create or update connection operation. - Required. - :type connection_name: str - :param parameters: The parameters supplied to the create or update connection operation. - Required. - :type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - connection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Connection: - """Create or update a connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The parameters supplied to the create or update connection operation. - Required. - :type connection_name: str - :param parameters: The parameters supplied to the create or update connection operation. - 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: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - connection_name: str, - parameters: Union[_models.ConnectionCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Connection: - """Create or update a connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The parameters supplied to the create or update connection operation. - Required. - :type connection_name: str - :param parameters: The parameters supplied to the create or update connection operation. Is - either a ConnectionCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters or IO[bytes] - :return: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ConnectionCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_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("Connection", 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, - connection_name: str, - parameters: _models.ConnectionUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Connection: - """Update a connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The parameters supplied to the update a connection operation. Required. - :type connection_name: str - :param parameters: The parameters supplied to the update a connection operation. Required. - :type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - connection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Connection: - """Update a connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The parameters supplied to the update a connection operation. Required. - :type connection_name: str - :param parameters: The parameters supplied to the update a connection operation. 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: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - automation_account_name: str, - connection_name: str, - parameters: Union[_models.ConnectionUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Connection: - """Update a connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The parameters supplied to the update a connection operation. Required. - :type connection_name: str - :param parameters: The parameters supplied to the update a connection operation. Is either a - ConnectionUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters or IO[bytes] - :return: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ConnectionUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Connection", pipeline_response.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 - ) -> AsyncItemPaged["_models.Connection"]: - """Retrieve a list of connections. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Connection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Connection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - cls: ClsType[_models.ConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("ConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_connection_type_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_type_operations.py deleted file mode 100644 index 605f84e5c4a6..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_type_operations.py +++ /dev/null @@ -1,423 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ConnectionTypeOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`connection_type` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, connection_type_name: str, **kwargs: Any - ) -> None: - """Delete the connection type. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectiontypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_type_name: The name of connection type. Required. - :type connection_type_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - connection_type_name=connection_type_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, connection_type_name: str, **kwargs: Any - ) -> _models.ConnectionType: - """Retrieve the connection type identified by connection type name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectiontypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_type_name: The name of connection type. Required. - :type connection_type_name: str - :return: ConnectionType or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.ConnectionType - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - connection_type_name=connection_type_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("ConnectionType", 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, - connection_type_name: str, - parameters: _models.ConnectionTypeCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionType: - """Create a connection type. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectiontypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_type_name: The parameters supplied to the create or update connection type - operation. Required. - :type connection_type_name: str - :param parameters: The parameters supplied to the create or update connection type operation. - Required. - :type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ConnectionType or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.ConnectionType - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - connection_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionType: - """Create a connection type. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectiontypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_type_name: The parameters supplied to the create or update connection type - operation. Required. - :type connection_type_name: str - :param parameters: The parameters supplied to the create or update connection type operation. - 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: ConnectionType or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.ConnectionType - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - connection_type_name: str, - parameters: Union[_models.ConnectionTypeCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ConnectionType: - """Create a connection type. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectiontypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_type_name: The parameters supplied to the create or update connection type - operation. Required. - :type connection_type_name: str - :param parameters: The parameters supplied to the create or update connection type operation. - Is either a ConnectionTypeCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters or - IO[bytes] - :return: ConnectionType or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.ConnectionType - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ConnectionTypeCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - connection_type_name=connection_type_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 [201, 409]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - 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 - ) -> AsyncItemPaged["_models.ConnectionType"]: - """Retrieve a list of connection types. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectiontypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either ConnectionType or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ConnectionType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("ConnectionTypeListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_credential_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_credential_operations.py deleted file mode 100644 index 7ef49e55641b..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_credential_operations.py +++ /dev/null @@ -1,569 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._credential_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_automation_account_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CredentialOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`credential` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, credential_name: str, **kwargs: Any - ) -> None: - """Delete the credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The name of credential. Required. - :type credential_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - credential_name=credential_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, credential_name: str, **kwargs: Any - ) -> _models.Credential: - """Retrieve the credential identified by credential name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The name of credential. Required. - :type credential_name: str - :return: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - credential_name=credential_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("Credential", 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, - credential_name: str, - parameters: _models.CredentialCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Credential: - """Create a credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The parameters supplied to the create or update credential operation. - Required. - :type credential_name: str - :param parameters: The parameters supplied to the create or update credential operation. - Required. - :type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - credential_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Credential: - """Create a credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The parameters supplied to the create or update credential operation. - Required. - :type credential_name: str - :param parameters: The parameters supplied to the create or update credential operation. - 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: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - credential_name: str, - parameters: Union[_models.CredentialCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Credential: - """Create a credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The parameters supplied to the create or update credential operation. - Required. - :type credential_name: str - :param parameters: The parameters supplied to the create or update credential operation. Is - either a CredentialCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters or IO[bytes] - :return: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CredentialCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - credential_name=credential_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("Credential", 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, - credential_name: str, - parameters: _models.CredentialUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Credential: - """Update a credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The parameters supplied to the Update credential operation. Required. - :type credential_name: str - :param parameters: The parameters supplied to the Update credential operation. Required. - :type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - credential_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Credential: - """Update a credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The parameters supplied to the Update credential operation. Required. - :type credential_name: str - :param parameters: The parameters supplied to the Update credential operation. 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: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - automation_account_name: str, - credential_name: str, - parameters: Union[_models.CredentialUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Credential: - """Update a credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The parameters supplied to the Update credential operation. Required. - :type credential_name: str - :param parameters: The parameters supplied to the Update credential operation. Is either a - CredentialUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters or IO[bytes] - :return: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CredentialUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - credential_name=credential_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("Credential", 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 - ) -> AsyncItemPaged["_models.Credential"]: - """Retrieve a list of credentials. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Credential or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Credential] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("CredentialListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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/_dsc_compilation_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_operations.py deleted file mode 100644 index 5b3f694a5355..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_operations.py +++ /dev/null @@ -1,496 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DscCompilationJobOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`dsc_compilation_job` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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, - resource_group_name: str, - automation_account_name: str, - compilation_job_name: str, - parameters: Union[_models.DscCompilationJobCreateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - 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, "DscCompilationJobCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - compilation_job_name=compilation_job_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 [201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - automation_account_name: str, - compilation_job_name: str, - parameters: _models.DscCompilationJobCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DscCompilationJob]: - """Creates the Dsc compilation job of the configuration. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param compilation_job_name: The DSC configuration Id. Required. - :type compilation_job_name: str - :param parameters: The parameters supplied to the create compilation job operation. Required. - :type parameters: ~azure.mgmt.automation.models.DscCompilationJobCreateParameters - :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 DscCompilationJob or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscCompilationJob] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - automation_account_name: str, - compilation_job_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DscCompilationJob]: - """Creates the Dsc compilation job of the configuration. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param compilation_job_name: The DSC configuration Id. Required. - :type compilation_job_name: str - :param parameters: The parameters supplied to the create compilation job operation. 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 DscCompilationJob or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscCompilationJob] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - automation_account_name: str, - compilation_job_name: str, - parameters: Union[_models.DscCompilationJobCreateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DscCompilationJob]: - """Creates the Dsc compilation job of the configuration. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param compilation_job_name: The DSC configuration Id. Required. - :type compilation_job_name: str - :param parameters: The parameters supplied to the create compilation job operation. Is either a - DscCompilationJobCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.DscCompilationJobCreateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DscCompilationJob or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscCompilationJob] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-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) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - compilation_job_name=compilation_job_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("DscCompilationJob", 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.DscCompilationJob].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DscCompilationJob]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, compilation_job_name: str, **kwargs: Any - ) -> _models.DscCompilationJob: - """Retrieve the Dsc configuration compilation job identified by job id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dsccompilationjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param compilation_job_name: The DSC configuration Id. Required. - :type compilation_job_name: str - :return: DscCompilationJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscCompilationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - compilation_job_name=compilation_job_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("DscCompilationJob", 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, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.DscCompilationJob"]: - """Retrieve a list of dsc compilation jobs. - - .. seealso:: - - http://aka.ms/azureautomationsdk/compilationjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 DscCompilationJob or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscCompilationJob] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscCompilationJobListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("DscCompilationJobListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get_stream( - self, resource_group_name: str, automation_account_name: str, job_id: str, job_stream_id: str, **kwargs: Any - ) -> _models.JobStream: - """Retrieve the job stream identified by job stream id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobstreamoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_id: The job id. Required. - :type job_id: str - :param job_stream_id: The job stream id. Required. - :type job_stream_id: str - :return: JobStream or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobStream - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) - - _request = build_get_stream_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_id=job_id, - job_stream_id=job_stream_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("JobStream", 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_stream_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_stream_operations.py deleted file mode 100644 index 7738f463bc32..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_stream_operations.py +++ /dev/null @@ -1,119 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -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 ..._utils.serialization import Deserializer, Serializer -from ...operations._dsc_compilation_job_stream_operations import build_list_by_job_request -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DscCompilationJobStreamOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`dsc_compilation_job_stream` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, job_id: str, **kwargs: Any - ) -> _models.JobStreamListResult: - """Retrieve all the job streams for the compilation Job. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobstreamoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_id: The job id. Required. - :type job_id: str - :return: JobStreamListResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobStreamListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) - - _request = build_list_by_job_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_id=job_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("JobStreamListResult", 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_configuration_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_configuration_operations.py deleted file mode 100644 index 8c90ebde7cac..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_configuration_operations.py +++ /dev/null @@ -1,663 +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 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, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._dsc_configuration_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_content_request, - build_get_request, - build_list_by_automation_account_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DscConfigurationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`dsc_configuration` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, configuration_name: str, **kwargs: Any - ) -> None: - """Delete the dsc configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The configuration name. Required. - :type configuration_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - configuration_name=configuration_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, configuration_name: str, **kwargs: Any - ) -> _models.DscConfiguration: - """Retrieve the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The configuration name. Required. - :type configuration_name: str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - configuration_name=configuration_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("DscConfiguration", 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, - configuration_name: str, - parameters: _models.DscConfigurationCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DscConfiguration: - """Create the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The create or update parameters for configuration. Required. - :type configuration_name: str - :param parameters: The create or update parameters for configuration. Required. - :type parameters: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - configuration_name: str, - parameters: str, - *, - content_type: Optional[str] = None, - **kwargs: Any - ) -> _models.DscConfiguration: - """Create the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The create or update parameters for configuration. Required. - :type configuration_name: str - :param parameters: The create or update parameters for configuration. Required. - :type parameters: str - :keyword content_type: Body Parameter content-type. Content type parameter for string body. - Default value is None. - :paramtype content_type: str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - configuration_name: str, - parameters: Union[_models.DscConfigurationCreateOrUpdateParameters, str], - **kwargs: Any - ) -> _models.DscConfiguration: - """Create the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The create or update parameters for configuration. Required. - :type configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a - DscConfigurationCreateOrUpdateParameters type or a str type. Required. - :type parameters: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters or str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - _json = None - _content = None - if isinstance(parameters, msrest.Model): - content_type = content_type or "application/json" - _json = self._serialize.body(parameters, "DscConfigurationCreateOrUpdateParameters") - elif isinstance(parameters, str): - _content = self._serialize.body(parameters, "str") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - configuration_name=configuration_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("DscConfiguration", 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, - configuration_name: str, - parameters: Optional[_models.DscConfigurationUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DscConfiguration: - """Create the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The create or update parameters for configuration. Required. - :type configuration_name: str - :param parameters: The create or update parameters for configuration. Default value is None. - :type parameters: ~azure.mgmt.automation.models.DscConfigurationUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - configuration_name: str, - parameters: Optional[str] = None, - *, - content_type: Optional[str] = None, - **kwargs: Any - ) -> _models.DscConfiguration: - """Create the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The create or update parameters for configuration. Required. - :type configuration_name: str - :param parameters: The create or update parameters for configuration. Default value is None. - :type parameters: str - :keyword content_type: Body Parameter content-type. Content type parameter for string body. - Default value is None. - :paramtype content_type: str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - automation_account_name: str, - configuration_name: str, - parameters: Optional[Union[_models.DscConfigurationUpdateParameters, str]] = None, - **kwargs: Any - ) -> _models.DscConfiguration: - """Create the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The create or update parameters for configuration. Required. - :type configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a - DscConfigurationUpdateParameters type or a str type. Default value is None. - :type parameters: ~azure.mgmt.automation.models.DscConfigurationUpdateParameters or str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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" if parameters else None - if parameters is not None: - _json = self._serialize.body(parameters, "DscConfigurationUpdateParameters") - else: - _json = None - elif isinstance(parameters, str): - if parameters is not None: - _content = self._serialize.body(parameters, "str") - else: - _content = None - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - configuration_name=configuration_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("DscConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_content( - self, resource_group_name: str, automation_account_name: str, configuration_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - """Retrieve the configuration script identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The configuration name. Required. - :type configuration_name: str - :return: AsyncIterator[bytes] or the result of cls(response) - :rtype: AsyncIterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - 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, - filter: Optional[str] = None, - skip: Optional[int] = None, - top: Optional[int] = None, - inlinecount: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.DscConfiguration"]: - """Retrieve a list of configurations. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :param skip: The number of rows to skip. Default value is None. - :type skip: int - :param top: The number of rows to take. Default value is None. - :type top: int - :param inlinecount: Return total rows. Default value is None. - :type inlinecount: str - :return: An iterator like instance of either DscConfiguration or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - filter=filter, - skip=skip, - top=top, - inlinecount=inlinecount, - 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("DscConfigurationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_dsc_node_configuration_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_configuration_operations.py deleted file mode 100644 index 2b85144dd04e..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_configuration_operations.py +++ /dev/null @@ -1,507 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DscNodeConfigurationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`dsc_node_configuration` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, node_configuration_name: str, **kwargs: Any - ) -> None: - """Delete the Dsc node configurations by node configuration. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeconfigurations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_configuration_name: The Dsc node configuration name. Required. - :type node_configuration_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_configuration_name=node_configuration_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, node_configuration_name: str, **kwargs: Any - ) -> _models.DscNodeConfiguration: - """Retrieve the Dsc node configurations by node configuration. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeconfigurations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_configuration_name: The Dsc node configuration name. Required. - :type node_configuration_name: str - :return: DscNodeConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNodeConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNodeConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_configuration_name=node_configuration_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("DscNodeConfiguration", 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, - node_configuration_name: str, - parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - 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, "DscNodeConfigurationCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_configuration_name=node_configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - 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, - node_configuration_name: str, - parameters: _models.DscNodeConfigurationCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DscNodeConfiguration]: - """Create the node configuration identified by node configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeconfigurations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_configuration_name: The Dsc node configuration name. Required. - :type node_configuration_name: str - :param parameters: The create or update parameters for configuration. Required. - :type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters - :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 DscNodeConfiguration or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - node_configuration_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DscNodeConfiguration]: - """Create the node configuration identified by node configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeconfigurations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_configuration_name: The Dsc node configuration name. Required. - :type node_configuration_name: str - :param parameters: The create or update parameters for configuration. 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 DscNodeConfiguration or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - node_configuration_name: str, - parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DscNodeConfiguration]: - """Create the node configuration identified by node configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeconfigurations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_configuration_name: The Dsc node configuration name. Required. - :type node_configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a - DscNodeConfigurationCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either DscNodeConfiguration or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-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) - lro_delay = kwargs.pop("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, - node_configuration_name=node_configuration_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("DscNodeConfiguration", 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.DscNodeConfiguration].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DscNodeConfiguration]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_by_automation_account( - self, - resource_group_name: str, - automation_account_name: str, - filter: Optional[str] = None, - skip: Optional[int] = None, - top: Optional[int] = None, - inlinecount: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.DscNodeConfiguration"]: - """Retrieve a list of dsc node configurations. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeconfigurations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :param skip: The number of rows to skip. Default value is None. - :type skip: int - :param top: The number of rows to take. Default value is None. - :type top: int - :param inlinecount: Return total rows. Default value is None. - :type inlinecount: str - :return: An iterator like instance of either DscNodeConfiguration or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscNodeConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNodeConfigurationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - filter=filter, - skip=skip, - top=top, - inlinecount=inlinecount, - 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("DscNodeConfigurationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_dsc_node_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_operations.py deleted file mode 100644 index 03e353300e82..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_operations.py +++ /dev/null @@ -1,441 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class DscNodeOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`dsc_node` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, node_id: str, **kwargs: Any - ) -> _models.DscNode: - """Delete the dsc node identified by node id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: The node id. Required. - :type node_id: str - :return: DscNode or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNode - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_id=node_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("DscNode", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, node_id: str, **kwargs: Any - ) -> _models.DscNode: - """Retrieve the dsc node identified by node id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: The node id. Required. - :type node_id: str - :return: DscNode or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNode - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_id=node_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("DscNode", 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, - node_id: str, - dsc_node_update_parameters: _models.DscNodeUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DscNode: - """Update the dsc node. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: Parameters supplied to the update dsc node. Required. - :type node_id: str - :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Required. - :type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DscNode or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNode - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - node_id: str, - dsc_node_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DscNode: - """Update the dsc node. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: Parameters supplied to the update dsc node. Required. - :type node_id: str - :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Required. - :type dsc_node_update_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: DscNode or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNode - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - automation_account_name: str, - node_id: str, - dsc_node_update_parameters: Union[_models.DscNodeUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.DscNode: - """Update the dsc node. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: Parameters supplied to the update dsc node. Required. - :type node_id: str - :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Is either a - DscNodeUpdateParameters type or a IO[bytes] type. Required. - :type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters or - IO[bytes] - :return: DscNode or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNode - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dsc_node_update_parameters, (IOBase, bytes)): - _content = dsc_node_update_parameters - else: - _json = self._serialize.body(dsc_node_update_parameters, "DscNodeUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_id=node_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) - - deserialized = self._deserialize("DscNode", 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, - filter: Optional[str] = None, - skip: Optional[int] = None, - top: Optional[int] = None, - inlinecount: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.DscNode"]: - """Retrieve a list of dsc nodes. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :param skip: The number of rows to skip. Default value is None. - :type skip: int - :param top: The number of rows to take. Default value is None. - :type top: int - :param inlinecount: Return total rows. Default value is None. - :type inlinecount: str - :return: An iterator like instance of either DscNode or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscNode] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNodeListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - filter=filter, - skip=skip, - top=top, - inlinecount=inlinecount, - 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("DscNodeListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_fields_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_fields_operations.py deleted file mode 100644 index fafa79b4ea48..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_fields_operations.py +++ /dev/null @@ -1,138 +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 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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._fields_operations import build_list_by_type_request -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class FieldsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`fields` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - ) -> AsyncItemPaged["_models.TypeField"]: - """Retrieve a list of fields of a given type identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/typefieldoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param type_name: The name of type. Required. - :type type_name: str - :return: An iterator like instance of either TypeField or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.TypeField] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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_type_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - type_name=type_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("TypeFieldListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/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 deleted file mode 100644 index 590f37d0a636..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_worker_group_operations.py +++ /dev/null @@ -1,431 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._hybrid_runbook_worker_group_operations import ( - build_delete_request, - build_get_request, - build_list_by_automation_account_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class HybridRunbookWorkerGroupOperations: - """ - .. 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_worker_group` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - **kwargs: Any - ) -> None: - """Delete a hybrid runbook worker group. - - .. seealso:: - - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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 - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - 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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - **kwargs: Any - ) -> _models.HybridRunbookWorkerGroup: - """Retrieve a hybrid runbook worker group. - - .. seealso:: - - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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 - :return: HybridRunbookWorkerGroup or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - 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, - 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("HybridRunbookWorkerGroup", 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, - hybrid_runbook_worker_group_name: str, - parameters: _models.HybridRunbookWorkerGroupUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridRunbookWorkerGroup: - """Update a hybrid runbook worker group. - - .. seealso:: - - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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 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 - :return: HybridRunbookWorkerGroup or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridRunbookWorkerGroup: - """Update a hybrid runbook worker group. - - .. seealso:: - - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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 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 - :return: HybridRunbookWorkerGroup or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - parameters: Union[_models.HybridRunbookWorkerGroupUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.HybridRunbookWorkerGroup: - """Update a hybrid runbook worker group. - - .. seealso:: - - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "HybridRunbookWorkerGroupUpdateParameters") - - _request = build_update_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]: - map_error(status_code=response.status_code, response=response, error_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 - - @distributed_trace - def list_by_automation_account( - self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.HybridRunbookWorkerGroup"]: - """Retrieve a list of hybrid runbook worker groups. - - .. seealso:: - - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 HybridRunbookWorkerGroup or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.HybridRunbookWorkerGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("HybridRunbookWorkerGroupsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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 deleted file mode 100644 index e1e5df2ae1bc..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_operations.py +++ /dev/null @@ -1,755 +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 collections.abc import MutableMapping -from io import IOBase -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, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._job_operations import ( - build_create_request, - build_get_output_request, - build_get_request, - build_get_runbook_content_request, - build_list_by_automation_account_request, - build_resume_request, - build_stop_request, - build_suspend_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class JobOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`job` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - """Retrieve the job output identified by job name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The name of the job to be created. Required. - :type job_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: AsyncIterator[bytes] or the result of cls(response) - :rtype: AsyncIterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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 = 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 get_runbook_content( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - """Retrieve the runbook content of the job identified by job name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: AsyncIterator[bytes] or the result of cls(response) - :rtype: AsyncIterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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 suspend( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """Suspend the job identified by job name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def stop( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """Stop the job identified by jobName. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.Job: - """Retrieve the job identified by job name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: Job or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Job - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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("Job", 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, - job_name: str, - parameters: _models.JobCreateParameters, - client_request_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Job: - """Create a job of the runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param parameters: The parameters supplied to the create job operation. Required. - :type parameters: ~azure.mgmt.automation.models.JobCreateParameters - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Job or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Job - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - parameters: IO[bytes], - client_request_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Job: - """Create a job of the runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param parameters: The parameters supplied to the create job operation. Required. - :type parameters: IO[bytes] - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Job or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Job - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - parameters: Union[_models.JobCreateParameters, IO[bytes]], - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.Job: - """Create a job of the runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param parameters: The parameters supplied to the create job operation. Is either a - JobCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.JobCreateParameters or IO[bytes] - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: Job or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Job - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "JobCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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 [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("Job", 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, - filter: Optional[str] = None, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.JobCollectionItem"]: - """Retrieve a list of jobs. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: An iterator like instance of either JobCollectionItem or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobCollectionItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - filter=filter, - client_request_id=client_request_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("JobListResultV2", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def resume( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """Resume the job identified by jobName. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore 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 deleted file mode 100644 index c0485cc3b5ab..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_schedule_operations.py +++ /dev/null @@ -1,420 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class JobScheduleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`job_schedule` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - 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. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobscheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_schedule_id: The job schedule name. Required. - :type job_schedule_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_schedule_id=job_schedule_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, job_schedule_id: str, **kwargs: Any - ) -> _models.JobSchedule: - """Retrieve the job schedule identified by job schedule name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobscheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_schedule_id: The job schedule name. Required. - :type job_schedule_id: str - :return: JobSchedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobSchedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_schedule_id=job_schedule_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("JobSchedule", 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, - job_schedule_id: str, - parameters: _models.JobScheduleCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.JobSchedule: - """Create a job schedule. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobscheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_schedule_id: The job schedule name. Required. - :type job_schedule_id: str - :param parameters: The parameters supplied to the create job schedule operation. Required. - :type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: JobSchedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobSchedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - automation_account_name: str, - job_schedule_id: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.JobSchedule: - """Create a job schedule. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobscheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_schedule_id: The job schedule name. Required. - :type job_schedule_id: str - :param parameters: The parameters supplied to the create job schedule operation. 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: JobSchedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobSchedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - automation_account_name: str, - job_schedule_id: str, - parameters: Union[_models.JobScheduleCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.JobSchedule: - """Create a job schedule. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobscheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_schedule_id: The job schedule name. Required. - :type job_schedule_id: str - :param parameters: The parameters supplied to the create job schedule operation. Is either a - JobScheduleCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters or IO[bytes] - :return: JobSchedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobSchedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "JobScheduleCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_schedule_id=job_schedule_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 [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("JobSchedule", 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, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.JobSchedule"]: - """Retrieve a list of job schedules. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobscheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 JobSchedule or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobSchedule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("JobScheduleListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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_stream_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_stream_operations.py deleted file mode 100644 index b0eb1882812c..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_stream_operations.py +++ /dev/null @@ -1,226 +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 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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._job_stream_operations import build_get_request, build_list_by_job_request -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class JobStreamOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`job_stream` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - job_stream_id: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.JobStream: - """Retrieve the job stream identified by job stream id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobstreamoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param job_stream_id: The job stream id. Required. - :type job_stream_id: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: JobStream or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobStream - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - job_stream_id=job_stream_id, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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("JobStream", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_job( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - filter: Optional[str] = None, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.JobStream"]: - """Retrieve a list of jobs streams identified by job name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobstreamoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: An iterator like instance of either JobStream or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobStream] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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_job_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - filter=filter, - client_request_id=client_request_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("JobStreamListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_keys_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_keys_operations.py deleted file mode 100644 index 7cc47e032190..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_keys_operations.py +++ /dev/null @@ -1,113 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -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 ..._utils.serialization import Deserializer, Serializer -from ...operations._keys_operations import build_list_by_automation_account_request -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class KeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> _models.KeyListResult: - """Retrieve the automation keys for an 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: KeyListResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.KeyListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - 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/_linked_workspace_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_linked_workspace_operations.py deleted file mode 100644 index b01936a54f92..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_linked_workspace_operations.py +++ /dev/null @@ -1,116 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -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 ..._utils.serialization import Deserializer, Serializer -from ...operations._linked_workspace_operations import build_get_request -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class LinkedWorkspaceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`linked_workspace` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> _models.LinkedWorkspace: - """Retrieve the linked workspace for the account id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/linkedworkspaceoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: LinkedWorkspace or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.LinkedWorkspace - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - 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/_module_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_module_operations.py deleted file mode 100644 index f2032d114a88..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_module_operations.py +++ /dev/null @@ -1,568 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._module_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_automation_account_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ModuleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`module` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any - ) -> None: - """Delete the module by name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The module name. Required. - :type module_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any - ) -> _models.Module: - """Retrieve the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The module name. Required. - :type module_name: str - :return: Module or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Module - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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, - module_name: str, - parameters: _models.ModuleCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Module: - """Create or Update the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param parameters: The create or update parameters for module. Required. - :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Module or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Module - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - module_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Module: - """Create or Update the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param parameters: The create or update parameters for module. 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, - module_name: str, - parameters: Union[_models.ModuleCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Module: - """Create or Update the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param parameters: The create or update parameters for module. Is either a - ModuleCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ModuleCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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, - module_name: str, - parameters: _models.ModuleUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Module: - """Update the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param parameters: The update parameters for module. Required. - :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Module or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Module - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - module_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Module: - """Update the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param parameters: The update parameters for module. 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, - module_name: str, - parameters: Union[_models.ModuleUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Module: - """Update the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param parameters: The update parameters for module. Is either a ModuleUpdateParameters type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ModuleUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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 - ) -> AsyncItemPaged["_models.Module"]: - """Retrieve a list of modules. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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", "2015-10-31")) - cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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/_node_count_information_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_count_information_operations.py deleted file mode 100644 index 926980ef42f6..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_count_information_operations.py +++ /dev/null @@ -1,124 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar, Union - -from azure.core import AsyncPipelineClient -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 ..._utils.serialization import Deserializer, Serializer -from ...operations._node_count_information_operations import build_get_request -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class NodeCountInformationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`node_count_information` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - count_type: Union[str, _models.CountType], - **kwargs: Any - ) -> _models.NodeCounts: - """Retrieve counts for Dsc Nodes. - - .. seealso:: - - http://aka.ms/azureautomationsdk/nodecounts - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param count_type: The type of counts to retrieve. Known values are: "status" and - "nodeconfiguration". Required. - :type count_type: str or ~azure.mgmt.automation.models.CountType - :return: NodeCounts or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.NodeCounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.NodeCounts] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - count_type=count_type, - 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("NodeCounts", 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/_node_reports_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_reports_operations.py deleted file mode 100644 index f1421b5544a3..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_reports_operations.py +++ /dev/null @@ -1,287 +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 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, - 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 ..._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 - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class NodeReportsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`node_reports` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - node_id: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.DscNodeReport"]: - """Retrieve the Dsc node report list by node id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodereportoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: The parameters supplied to the list operation. Required. - :type node_id: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :return: An iterator like instance of either DscNodeReport or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscNodeReport] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNodeReportListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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_node_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_id=node_id, - 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("DscNodeReportListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, node_id: str, report_id: str, **kwargs: Any - ) -> _models.DscNodeReport: - """Retrieve the Dsc node report data by node id and report id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodereportoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: The Dsc node id. Required. - :type node_id: str - :param report_id: The report id. Required. - :type report_id: str - :return: DscNodeReport or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNodeReport - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNodeReport] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_id=node_id, - report_id=report_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("DscNodeReport", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_content( - self, resource_group_name: str, automation_account_name: str, node_id: str, report_id: str, **kwargs: Any - ) -> JSON: - """Retrieve the Dsc node reports by node id and report id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodereportoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: The Dsc node id. Required. - :type node_id: str - :param report_id: The report id. Required. - :type report_id: str - :return: JSON or the result of cls(response) - :rtype: JSON - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[JSON] = kwargs.pop("cls", None) - - _request = build_get_content_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_id=node_id, - report_id=report_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("object", 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/_object_data_types_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_object_data_types_operations.py deleted file mode 100644 index d75e8cd01635..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_object_data_types_operations.py +++ /dev/null @@ -1,222 +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 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, - 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 ..._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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ObjectDataTypesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`object_data_types` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - ) -> AsyncItemPaged["_models.TypeField"]: - """Retrieve a list of fields of a given type identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/objectdatatypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param type_name: The name of type. Required. - :type type_name: str - :return: An iterator like instance of either TypeField or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.TypeField] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_fields_by_module_and_type_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - type_name=type_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("TypeFieldListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_fields_by_type( - self, resource_group_name: str, automation_account_name: str, type_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.TypeField"]: - """Retrieve a list of fields of a given type across all accessible modules. - - .. seealso:: - - http://aka.ms/azureautomationsdk/objectdatatypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param type_name: The name of type. Required. - :type type_name: str - :return: An iterator like instance of either TypeField or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.TypeField] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_fields_by_type_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - type_name=type_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("TypeFieldListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/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 f9d0aaea0abd..5002a47e1bc4 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,12 +1,16 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -16,21 +20,202 @@ 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 ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_list_request +from ..._utils.utils import ClientMixinABC +from ...operations._operations import ( + build_activity_get_request, + build_activity_list_by_module_request, + build_agent_registration_information_get_request, + build_agent_registration_information_regenerate_key_request, + build_automation_account_create_or_update_request, + build_automation_account_delete_request, + build_automation_account_get_request, + build_automation_account_list_by_resource_group_request, + build_automation_account_list_deleted_runbooks_request, + build_automation_account_list_request, + build_automation_account_update_request, + build_automation_convert_graph_runbook_content_request, + build_certificate_create_or_update_request, + build_certificate_delete_request, + build_certificate_get_request, + build_certificate_list_by_automation_account_request, + build_certificate_update_request, + build_connection_create_or_update_request, + build_connection_delete_request, + build_connection_get_request, + build_connection_list_by_automation_account_request, + build_connection_type_create_or_update_request, + build_connection_type_delete_request, + build_connection_type_get_request, + build_connection_type_list_by_automation_account_request, + build_connection_update_request, + build_credential_create_or_update_request, + build_credential_delete_request, + build_credential_get_request, + build_credential_list_by_automation_account_request, + build_credential_update_request, + build_deleted_automation_accounts_list_by_subscription_request, + build_dsc_configuration_create_or_update_request, + build_dsc_configuration_delete_request, + build_dsc_configuration_get_content_request, + build_dsc_configuration_get_request, + build_dsc_configuration_list_by_automation_account_request, + build_dsc_configuration_update_request, + build_dsc_node_configuration_create_or_update_request, + build_dsc_node_configuration_delete_request, + build_dsc_node_configuration_get_request, + build_dsc_node_configuration_list_by_automation_account_request, + build_dsc_node_delete_request, + build_dsc_node_get_request, + build_dsc_node_list_by_automation_account_request, + build_dsc_node_update_request, + build_fields_list_by_type_request, + build_hybrid_runbook_worker_group_create_request, + build_hybrid_runbook_worker_group_delete_request, + build_hybrid_runbook_worker_group_get_request, + build_hybrid_runbook_worker_group_list_by_automation_account_request, + build_hybrid_runbook_worker_group_update_request, + build_hybrid_runbook_workers_create_request, + build_hybrid_runbook_workers_delete_request, + build_hybrid_runbook_workers_get_request, + build_hybrid_runbook_workers_list_by_hybrid_runbook_worker_group_request, + build_hybrid_runbook_workers_move_request, + build_hybrid_runbook_workers_patch_request, + build_job_create_request, + build_job_get_output_request, + build_job_get_request, + build_job_get_runbook_content_request, + build_job_list_by_automation_account_request, + build_job_resume_request, + build_job_schedule_create_request, + build_job_schedule_delete_request, + build_job_schedule_get_request, + build_job_schedule_list_by_automation_account_request, + build_job_stop_request, + build_job_stream_get_request, + build_job_stream_list_by_job_request, + build_job_suspend_request, + build_keys_list_by_automation_account_request, + build_linked_workspace_get_request, + build_module_create_or_update_request, + build_module_delete_request, + build_module_get_request, + build_module_list_by_automation_account_request, + build_module_update_request, + build_node_count_information_get_request, + build_node_reports_get_content_request, + build_node_reports_get_request, + build_node_reports_list_by_node_request, + build_object_data_types_list_fields_by_module_and_type_request, + build_object_data_types_list_fields_by_type_request, + build_operations_list_request, + build_package_create_or_update_request, + build_package_delete_request, + build_package_get_request, + build_package_list_by_runtime_environment_request, + build_package_update_request, + build_private_endpoint_connections_create_or_update_request, + build_private_endpoint_connections_delete_request, + build_private_endpoint_connections_get_request, + build_private_endpoint_connections_list_by_automation_account_request, + build_private_link_resources_automation_request, + build_python2_package_create_or_update_request, + build_python2_package_delete_request, + build_python2_package_get_request, + build_python2_package_list_by_automation_account_request, + build_python2_package_update_request, + build_python3_package_create_or_update_request, + build_python3_package_delete_request, + build_python3_package_get_request, + build_python3_package_list_by_automation_account_request, + build_python3_package_update_request, + build_runbook_create_or_update_request, + build_runbook_delete_request, + build_runbook_draft_get_content_request, + build_runbook_draft_get_request, + build_runbook_draft_replace_content_request, + build_runbook_draft_undo_edit_request, + build_runbook_get_content_request, + build_runbook_get_request, + build_runbook_list_by_automation_account_request, + build_runbook_publish_request, + build_runbook_update_request, + build_runtime_environments_create_request, + build_runtime_environments_delete_request, + build_runtime_environments_get_request, + build_runtime_environments_list_by_automation_account_request, + build_runtime_environments_update_request, + build_schedule_create_or_update_request, + build_schedule_delete_request, + build_schedule_get_request, + build_schedule_list_by_automation_account_request, + build_schedule_update_request, + build_software_update_configuration_machine_runs_get_by_id_request, + build_software_update_configuration_machine_runs_list_request, + build_software_update_configuration_runs_get_by_id_request, + build_software_update_configuration_runs_list_request, + build_software_update_configurations_create_request, + build_software_update_configurations_delete_request, + build_software_update_configurations_get_by_name_request, + build_software_update_configurations_list_request, + build_source_control_create_or_update_request, + build_source_control_delete_request, + build_source_control_get_request, + build_source_control_list_by_automation_account_request, + build_source_control_sync_job_create_request, + build_source_control_sync_job_get_request, + build_source_control_sync_job_list_by_automation_account_request, + build_source_control_sync_job_streams_get_request, + build_source_control_sync_job_streams_list_by_sync_job_request, + build_source_control_update_request, + build_statistics_list_by_automation_account_request, + build_test_job_create_request, + build_test_job_get_request, + build_test_job_resume_request, + build_test_job_stop_request, + build_test_job_streams_get_request, + build_test_job_streams_list_by_test_job_request, + build_test_job_suspend_request, + build_usages_list_by_automation_account_request, + build_variable_create_or_update_request, + build_variable_delete_request, + build_variable_get_request, + build_variable_list_by_automation_account_request, + build_variable_update_request, + build_watcher_create_or_update_request, + build_watcher_delete_request, + build_watcher_get_request, + build_watcher_list_by_automation_account_request, + build_watcher_start_request, + build_watcher_stop_request, + build_watcher_update_request, + build_webhook_create_or_update_request, + build_webhook_delete_request, + build_webhook_generate_uri_request, + build_webhook_get_request, + build_webhook_list_by_automation_account_request, + build_webhook_update_request, +) from .._configuration import AutomationClientConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] List = list @@ -44,8 +229,6 @@ class Operations: :attr:`operations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") @@ -57,15 +240,14 @@ def __init__(self, *args, **kwargs) -> None: 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) + :return: An iterator like instance of Operation :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -78,25 +260,52 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_operations_list_request( + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -109,12 +318,20364 @@ 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( + error = _failsafe_deserialize( _models.ErrorResponse, - pipeline_response, + response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) + + +class SoftwareUpdateConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`software_update_configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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_name( + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfiguration: + """Get a single software update configuration by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_name: The name of the software update configuration to be + created. Required. + :type software_update_configuration_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: SoftwareUpdateConfiguration. The SoftwareUpdateConfiguration is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) + + _request = build_software_update_configurations_get_by_name_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + software_update_configuration_name=software_update_configuration_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfiguration, response.json()) + + 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, + software_update_configuration_name: str, + parameters: _models.SoftwareUpdateConfiguration, + *, + client_request_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SoftwareUpdateConfiguration: + """Create a new software update configuration with the name given in the URI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_name: The name of the software update configuration to be + created. Required. + :type software_update_configuration_name: str + :param parameters: Request body. Required. + :type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SoftwareUpdateConfiguration. The SoftwareUpdateConfiguration is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_name: str, + parameters: JSON, + *, + client_request_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SoftwareUpdateConfiguration: + """Create a new software update configuration with the name given in the URI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_name: The name of the software update configuration to be + created. Required. + :type software_update_configuration_name: str + :param parameters: Request body. Required. + :type parameters: JSON + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SoftwareUpdateConfiguration. The SoftwareUpdateConfiguration is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_name: str, + parameters: IO[bytes], + *, + client_request_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SoftwareUpdateConfiguration: + """Create a new software update configuration with the name given in the URI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_name: The name of the software update configuration to be + created. Required. + :type software_update_configuration_name: str + :param parameters: Request body. Required. + :type parameters: IO[bytes] + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SoftwareUpdateConfiguration. The SoftwareUpdateConfiguration is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_name: str, + parameters: Union[_models.SoftwareUpdateConfiguration, JSON, IO[bytes]], + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfiguration: + """Create a new software update configuration with the name given in the URI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_name: The name of the software update configuration to be + created. Required. + :type software_update_configuration_name: str + :param parameters: Request body. Is one of the following types: SoftwareUpdateConfiguration, + JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration or JSON or + IO[bytes] + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: SoftwareUpdateConfiguration. The SoftwareUpdateConfiguration is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_software_update_configurations_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + software_update_configuration_name=software_update_configuration_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """delete a specific software update configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_name: The name of the software update configuration to be + created. Required. + :type software_update_configuration_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_software_update_configurations_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + software_update_configuration_name=software_update_configuration_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + automation_account_name: str, + *, + client_request_id: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfigurationListResult: + """Get all software update configurations for the account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: SoftwareUpdateConfigurationListResult. The SoftwareUpdateConfigurationListResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftwareUpdateConfigurationListResult] = kwargs.pop("cls", None) + + _request = build_software_update_configurations_list_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfigurationListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The HybridRunbookWorker is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) + + _request = build_hybrid_runbook_workers_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridRunbookWorker, response.json()) + + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The HybridRunbookWorker is compatible with MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Create a hybrid runbook worker. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridRunbookWorker. The HybridRunbookWorker is compatible with MutableMapping + :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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The HybridRunbookWorker is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Create a hybrid runbook worker. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 one of the following types: HybridRunbookWorkerCreateParameters, JSON, + IO[bytes] Required. + :type hybrid_runbook_worker_creation_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters or JSON or IO[bytes] + :return: HybridRunbookWorker. The HybridRunbookWorker is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(hybrid_runbook_worker_creation_parameters, (IOBase, bytes)): + _content = hybrid_runbook_worker_creation_parameters + else: + _content = json.dumps(hybrid_runbook_worker_creation_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hybrid_runbook_workers_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridRunbookWorker, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def patch( + 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: Optional[_models.HybridRunbookWorkerCreateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. Default value is None. + :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. The HybridRunbookWorker is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch( + 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: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. Default value is None. + :type hybrid_runbook_worker_creation_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridRunbookWorker. The HybridRunbookWorker is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch( + 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: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. Default value is None. + :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. The HybridRunbookWorker is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def patch( + 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: Optional[ + Union[_models.HybridRunbookWorkerCreateParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 one of the following types: HybridRunbookWorkerCreateParameters, JSON, + IO[bytes] Default value is None. + :type hybrid_runbook_worker_creation_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters or JSON or IO[bytes] + :return: HybridRunbookWorker. The HybridRunbookWorker is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if hybrid_runbook_worker_creation_parameters else None + cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if hybrid_runbook_worker_creation_parameters else None + _content = None + if isinstance(hybrid_runbook_worker_creation_parameters, (IOBase, bytes)): + _content = hybrid_runbook_worker_creation_parameters + else: + if hybrid_runbook_worker_creation_parameters is not None: + _content = json.dumps(hybrid_runbook_worker_creation_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_hybrid_runbook_workers_patch_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridRunbookWorker, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_hybrid_runbook_workers_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await 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 = _failsafe_deserialize( + _models.ErrorResponse, + 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 + ) -> AsyncItemPaged["_models.HybridRunbookWorker"]: + """Retrieve a list of hybrid runbook workers. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. + :type hybrid_runbook_worker_group_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of HybridRunbookWorker + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.HybridRunbookWorker] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.HybridRunbookWorker]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_hybrid_runbook_workers_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.HybridRunbookWorker], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def move( + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def move( + 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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Move a hybrid worker to a different group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def move( + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def move( + 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, JSON, IO[bytes]], + **kwargs: Any + ) -> None: + """Move a hybrid worker to a different group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 one + of the following types: HybridRunbookWorkerMoveParameters, JSON, IO[bytes] Required. + :type hybrid_runbook_worker_move_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerMoveParameters or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(hybrid_runbook_worker_move_parameters, (IOBase, bytes)): + _content = hybrid_runbook_worker_move_parameters + else: + _content = json.dumps(hybrid_runbook_worker_move_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hybrid_runbook_workers_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class Python2PackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`python2_package` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, package_name: str, **kwargs: Any + ) -> _models.Module: + """Retrieve the python 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Module] = kwargs.pop("cls", None) + + _request = build_python2_package_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + 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 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the python 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The create or update parameters for python package. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :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 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Module: + """Create or Update the python 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The create or update parameters for python package. Is one of the following + types: PythonPackageCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or JSON or + IO[bytes] + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_python2_package_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + 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 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the python 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The update parameters for python package. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :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 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Module: + """Update the python 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The update parameters for python package. Is one of the following types: + PythonPackageUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or JSON or + IO[bytes] + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_python2_package_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_python2_package_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Module"]: + """Retrieve a list of python 2 packages. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Module + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Module] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Module]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_python2_package_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Module], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Module] = kwargs.pop("cls", None) + + _request = build_python3_package_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the python 3 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The create or update parameters for python package. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Module: + """Create or Update the python 3 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The create or update parameters for python package. Is one of the following + types: PythonPackageCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or JSON or + IO[bytes] + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_python3_package_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the python 3 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The update parameters for python package. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Module: + """Update the python 3 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The update parameters for python package. Is one of the following types: + PythonPackageUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or JSON or + IO[bytes] + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_python3_package_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, automation_account_name: str, package_name: str, **kwargs: Any + ) -> None: + """Delete the python 3 package by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_python3_package_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Module"]: + """Retrieve a list of python 3 packages. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Module + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Module] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Module]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_python3_package_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Module], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class RuntimeEnvironmentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`runtime_environments` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, runtime_environment_name: str, **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Get information about the Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuntimeEnvironment] = kwargs.pop("cls", None) + + _request = build_runtime_environments_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RuntimeEnvironment, response.json()) + + 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, + runtime_environment_name: str, + parameters: _models.RuntimeEnvironment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. 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: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: Union[_models.RuntimeEnvironment, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. Is one of the + following types: RuntimeEnvironment, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironment or JSON or IO[bytes] + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RuntimeEnvironment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_runtime_environments_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RuntimeEnvironment, response.json()) + + 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, + runtime_environment_name: str, + parameters: _models.RuntimeEnvironmentUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironmentUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. 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: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: Union[_models.RuntimeEnvironmentUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. Is one of the following + types: RuntimeEnvironmentUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironmentUpdateParameters or JSON or + IO[bytes] + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RuntimeEnvironment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_runtime_environments_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RuntimeEnvironment, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, automation_account_name: str, runtime_environment_name: str, **kwargs: Any + ) -> None: + """Delete the Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_runtime_environments_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.RuntimeEnvironment"]: + """Retrieve a list of RuntimeEnvironments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of RuntimeEnvironment + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.RuntimeEnvironment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RuntimeEnvironment]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_runtime_environments_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RuntimeEnvironment], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + 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, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :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: JSON, + *, + 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Required. + :type parameters: JSON + :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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Is one of the following types: PrivateEndpointConnection, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.automation.models.PrivateEndpointConnection or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: 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, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: + """List all private endpoint connections on a Automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateEndpointConnection], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class AutomationAccountOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`automation_account` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> _models.AutomationAccount: + """Get information about an Automation Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) + + _request = build_automation_account_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AutomationAccount, response.json()) + + 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, + parameters: _models.AutomationAccountCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutomationAccount: + """Create or update automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the create or update automation account. Required. + :type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutomationAccount: + """Create or update automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the create or update automation account. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutomationAccount: + """Create or update automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the create or update automation account. 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: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + parameters: Union[_models.AutomationAccountCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AutomationAccount: + """Create or update automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the create or update automation account. Is one of + the following types: AutomationAccountCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters or + JSON or IO[bytes] + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_automation_account_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AutomationAccount, response.json()) + + 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, + parameters: _models.AutomationAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutomationAccount: + """Update an automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the update automation account. Required. + :type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutomationAccount: + """Update an automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the update automation account. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutomationAccount: + """Update an automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the update automation account. 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: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + parameters: Union[_models.AutomationAccountUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AutomationAccount: + """Update an automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the update automation account. Is one of the + following types: AutomationAccountUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters or JSON or + IO[bytes] + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_automation_account_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AutomationAccount, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> None: + """Delete an automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_automation_account_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.AutomationAccount"]: + """Retrieve a list of accounts within a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of AutomationAccount + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.AutomationAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutomationAccount]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_account_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.AutomationAccount], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + 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. + + :return: An iterator like instance of AutomationAccount + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.AutomationAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutomationAccount]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_account_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.AutomationAccount], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_deleted_runbooks( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DeletedRunbook"]: + """Retrieve the deleted runbooks for an automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of DeletedRunbook + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DeletedRunbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeletedRunbook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_account_list_deleted_runbooks_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DeletedRunbook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class NodeCountInformationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`node_count_information` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + count_type: Union[str, _models.CountType], + **kwargs: Any + ) -> _models.NodeCounts: + """Retrieve counts for Dsc Nodes. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param count_type: The type of counts to retrieve. Known values are: "status" and + "nodeconfiguration". Required. + :type count_type: str or ~azure.mgmt.automation.models.CountType + :return: NodeCounts. The NodeCounts is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.NodeCounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NodeCounts] = kwargs.pop("cls", None) + + _request = build_node_count_information_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + count_type=count_type, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NodeCounts, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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 automation( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateLinkResource"]: + """Gets the private link resources that need to be created for Automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_link_resources_automation_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateLinkResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class AgentRegistrationInformationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`agent_registration_information` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> _models.AgentRegistration: + """Retrieve the automation agent registration information. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: AgentRegistration. The AgentRegistration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AgentRegistration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) + + _request = build_agent_registration_information_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentRegistration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def regenerate_key( + self, + resource_group_name: str, + automation_account_name: str, + parameters: _models.AgentRegistrationRegenerateKeyParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AgentRegistration: + """Regenerate a primary or secondary agent registration key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: The name of the agent registration key to be regenerated. Required. + :type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AgentRegistration. The AgentRegistration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AgentRegistration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_key( + self, + resource_group_name: str, + automation_account_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AgentRegistration: + """Regenerate a primary or secondary agent registration key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: The name of the agent registration key to be regenerated. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AgentRegistration. The AgentRegistration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AgentRegistration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_key( + self, + resource_group_name: str, + automation_account_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AgentRegistration: + """Regenerate a primary or secondary agent registration key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: The name of the agent registration key to be regenerated. 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: AgentRegistration. The AgentRegistration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AgentRegistration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_key( + self, + resource_group_name: str, + automation_account_name: str, + parameters: Union[_models.AgentRegistrationRegenerateKeyParameter, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AgentRegistration: + """Regenerate a primary or secondary agent registration key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: The name of the agent registration key to be regenerated. Is one of the + following types: AgentRegistrationRegenerateKeyParameter, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter or JSON + or IO[bytes] + :return: AgentRegistration. The AgentRegistration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AgentRegistration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_agent_registration_information_regenerate_key_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentRegistration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class StatisticsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`statistics` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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 + ) -> AsyncItemPaged["_models.Statistics"]: + """Retrieve the statistics for the account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of Statistics + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Statistics] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Statistics]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_statistics_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Statistics], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class UsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`usages` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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 + ) -> AsyncItemPaged["_models.Usage"]: + """Retrieve the usage for the account id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Usage + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Usage]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_usages_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Usage], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class KeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`keys` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> _models.KeyListResult: + """Retrieve the automation keys for an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: KeyListResult. The KeyListResult is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.KeyListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) + + _request = build_keys_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.KeyListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class JobOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`job` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.JobCollectionItem"]: + """Retrieve a list of jobs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: An iterator like instance of JobCollectionItem + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobCollectionItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.JobCollectionItem]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_job_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.JobCollectionItem], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.Job: + """Retrieve the job identified by job name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: Job. The Job is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + + _request = build_job_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Job, response.json()) + + 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, + job_name: str, + parameters: _models.JobCreateParameters, + *, + client_request_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Job: + """Create a job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :param parameters: The parameters supplied to the create job operation. Required. + :type parameters: ~azure.mgmt.automation.models.JobCreateParameters + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Job. The Job is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + parameters: JSON, + *, + client_request_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Job: + """Create a job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :param parameters: The parameters supplied to the create job operation. Required. + :type parameters: JSON + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Job. The Job is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + parameters: IO[bytes], + *, + client_request_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Job: + """Create a job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :param parameters: The parameters supplied to the create job operation. Required. + :type parameters: IO[bytes] + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Job. The Job is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + parameters: Union[_models.JobCreateParameters, JSON, IO[bytes]], + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.Job: + """Create a job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :param parameters: The parameters supplied to the create job operation. Is one of the following + types: JobCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.JobCreateParameters or JSON or IO[bytes] + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: Job. The Job is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_job_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Job, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_output( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> str: + """Retrieve the job output identified by job name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_job_get_output_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_runbook_content( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> str: + """Retrieve the runbook content of the job identified by job name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_job_get_runbook_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def suspend( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """Suspend the job identified by job name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_job_suspend_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """Stop the job identified by jobName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_job_stop_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def resume( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """Resume the job identified by jobName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_job_resume_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class LinkedWorkspaceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`linked_workspace` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> _models.LinkedWorkspace: + """Retrieve the linked workspace for the account id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: LinkedWorkspace. The LinkedWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.LinkedWorkspace + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.LinkedWorkspace] = kwargs.pop("cls", None) + + _request = build_linked_workspace_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LinkedWorkspace, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ObjectDataTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`object_data_types` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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_type( + self, resource_group_name: str, automation_account_name: str, type_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.TypeField"]: + """Retrieve a list of fields of a given type across all accessible modules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param type_name: The name of type. Required. + :type type_name: str + :return: An iterator like instance of TypeField + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.TypeField] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TypeField]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_object_data_types_list_fields_by_type_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + type_name=type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.TypeField], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @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 + ) -> AsyncItemPaged["_models.TypeField"]: + """Retrieve a list of fields of a given type identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param type_name: The name of type. Required. + :type type_name: str + :return: An iterator like instance of TypeField + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.TypeField] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TypeField]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_object_data_types_list_fields_by_module_and_type_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + type_name=type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.TypeField], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class SoftwareUpdateConfigurationMachineRunsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`software_update_configuration_machine_runs` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_machine_run_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfigurationMachineRun: + """Get a single software update configuration machine run by Id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_machine_run_id: The Id of the software update + configuration machine run. Required. + :type software_update_configuration_machine_run_id: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: SoftwareUpdateConfigurationMachineRun. The SoftwareUpdateConfigurationMachineRun is + compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftwareUpdateConfigurationMachineRun] = kwargs.pop("cls", None) + + _request = build_software_update_configuration_machine_runs_get_by_id_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + software_update_configuration_machine_run_id=software_update_configuration_machine_run_id, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfigurationMachineRun, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + automation_account_name: str, + *, + client_request_id: Optional[str] = None, + filter: Optional[str] = None, + skip: Optional[str] = None, + top: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfigurationMachineRunListResult: + """Return list of software update configuration machine runs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword filter: The filter to apply on the operation. You can use the following filters: + 'properties/osType', 'properties/status', 'properties/startTime', and + 'properties/softwareUpdateConfiguration/name'. Default value is None. + :paramtype filter: str + :keyword skip: number of entries you skip before returning results. Default value is None. + :paramtype skip: str + :keyword top: Maximum number of entries returned in the results collection. Default value is + None. + :paramtype top: str + :return: SoftwareUpdateConfigurationMachineRunListResult. The + SoftwareUpdateConfigurationMachineRunListResult is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRunListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftwareUpdateConfigurationMachineRunListResult] = kwargs.pop("cls", None) + + _request = build_software_update_configuration_machine_runs_list_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + filter=filter, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfigurationMachineRunListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class SoftwareUpdateConfigurationRunsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`software_update_configuration_runs` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_run_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfigurationRun: + """Get a single software update configuration Run by Id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_run_id: The Id of the software update configuration run. + Required. + :type software_update_configuration_run_id: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: SoftwareUpdateConfigurationRun. The SoftwareUpdateConfigurationRun is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftwareUpdateConfigurationRun] = kwargs.pop("cls", None) + + _request = build_software_update_configuration_runs_get_by_id_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + software_update_configuration_run_id=software_update_configuration_run_id, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfigurationRun, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + automation_account_name: str, + *, + client_request_id: Optional[str] = None, + filter: Optional[str] = None, + skip: Optional[str] = None, + top: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfigurationRunListResult: + """Return list of software update configuration runs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword filter: The filter to apply on the operation. You can use the following filters: + 'properties/osType', 'properties/status', 'properties/startTime', and + 'properties/softwareUpdateConfiguration/name'. Default value is None. + :paramtype filter: str + :keyword skip: Number of entries you skip before returning results. Default value is None. + :paramtype skip: str + :keyword top: Maximum number of entries returned in the results collection. Default value is + None. + :paramtype top: str + :return: SoftwareUpdateConfigurationRunListResult. The SoftwareUpdateConfigurationRunListResult + is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftwareUpdateConfigurationRunListResult] = kwargs.pop("cls", None) + + _request = build_software_update_configuration_runs_list_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + filter=filter, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfigurationRunListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class WebhookOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`webhook` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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: + """Generates a Uri for use in creating a webhook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_webhook_generate_uri_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, automation_account_name: str, webhook_name: str, **kwargs: Any + ) -> _models.Webhook: + """Retrieve the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) + + _request = build_webhook_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Webhook, response.json()) + + 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, + webhook_name: str, + parameters: _models.WebhookCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Webhook: + """Create the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The create or update parameters for webhook. Required. + :type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + webhook_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Webhook: + """Create the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The create or update parameters for webhook. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + webhook_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Webhook: + """Create the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The create or update parameters for webhook. 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: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + webhook_name: str, + parameters: Union[_models.WebhookCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Webhook: + """Create the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The create or update parameters for webhook. Is one of the following types: + WebhookCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_webhook_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Webhook, response.json()) + + 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, + webhook_name: str, + parameters: _models.WebhookUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Webhook: + """Update the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The update parameters for webhook. Required. + :type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + webhook_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Webhook: + """Update the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The update parameters for webhook. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + webhook_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Webhook: + """Update the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The update parameters for webhook. 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: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + webhook_name: str, + parameters: Union[_models.WebhookUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Webhook: + """Update the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The update parameters for webhook. Is one of the following types: + WebhookUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters or JSON or IO[bytes] + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_webhook_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Webhook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, automation_account_name: str, webhook_name: str, **kwargs: Any + ) -> None: + """Delete the webhook by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_webhook_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Webhook"]: + """Retrieve a list of webhooks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of Webhook + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Webhook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_webhook_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Webhook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DscNodeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`dsc_node` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, node_id: str, **kwargs: Any + ) -> _models.DscNode: + """Retrieve the dsc node identified by node id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :return: DscNode. The DscNode is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) + + _request = build_dsc_node_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_id=node_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscNode, response.json()) + + 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, + node_id: str, + dsc_node_update_parameters: _models.DscNodeUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscNode: + """Update the dsc node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Required. + :type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DscNode. The DscNode is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + node_id: str, + dsc_node_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscNode: + """Update the dsc node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Required. + :type dsc_node_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DscNode. The DscNode is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + node_id: str, + dsc_node_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscNode: + """Update the dsc node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Required. + :type dsc_node_update_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: DscNode. The DscNode is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + node_id: str, + dsc_node_update_parameters: Union[_models.DscNodeUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.DscNode: + """Update the dsc node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Is one of the + following types: DscNodeUpdateParameters, JSON, IO[bytes] Required. + :type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters or JSON + or IO[bytes] + :return: DscNode. The DscNode is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(dsc_node_update_parameters, (IOBase, bytes)): + _content = dsc_node_update_parameters + else: + _content = json.dumps(dsc_node_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dsc_node_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_id=node_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscNode, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, automation_account_name: str, node_id: str, **kwargs: Any) -> None: + """Delete the dsc node identified by node id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_dsc_node_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_id=node_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, + resource_group_name: str, + automation_account_name: str, + *, + filter: Optional[str] = None, + skip: Optional[int] = None, + top: Optional[int] = None, + inlinecount: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.DscNode"]: + """Retrieve a list of dsc nodes. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword skip: The number of rows to skip. Default value is None. + :paramtype skip: int + :keyword top: The number of rows to take. Default value is None. + :paramtype top: int + :keyword inlinecount: Return total rows. Default value is None. + :paramtype inlinecount: str + :return: An iterator like instance of DscNode + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DscNode]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dsc_node_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + skip=skip, + top=top, + inlinecount=inlinecount, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DscNode], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class NodeReportsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`node_reports` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + node_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.DscNodeReport"]: + """Retrieve the Dsc node report list by node id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of DscNodeReport + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscNodeReport] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DscNodeReport]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_node_reports_list_by_node_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_id=node_id, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DscNodeReport], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, automation_account_name: str, node_id: str, report_id: str, **kwargs: Any + ) -> _models.DscNodeReport: + """Retrieve the Dsc node report data by node id and report id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :param report_id: The report id. Required. + :type report_id: str + :return: DscNodeReport. The DscNodeReport is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNodeReport + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DscNodeReport] = kwargs.pop("cls", None) + + _request = build_node_reports_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_id=node_id, + report_id=report_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscNodeReport, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_content( + self, resource_group_name: str, automation_account_name: str, node_id: str, report_id: str, **kwargs: Any + ) -> str: + """Retrieve the Dsc node reports by node id and report id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :param report_id: The report id. Required. + :type report_id: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_node_reports_get_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_id=node_id, + report_id=report_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class CertificateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`certificate` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, certificate_name: str, **kwargs: Any + ) -> _models.Certificate: + """Retrieve the certificate identified by certificate name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + + _request = build_certificate_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Certificate, response.json()) + + 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, + certificate_name: str, + parameters: _models.CertificateCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Certificate: + """Create a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the create or update certificate operation. + Required. + :type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + certificate_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Certificate: + """Create a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the create or update certificate operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + certificate_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Certificate: + """Create a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the create or update certificate operation. + 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: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Certificate: + """Create a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the create or update certificate operation. Is + one of the following types: CertificateCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_certificate_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Certificate, response.json()) + + 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, + certificate_name: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Certificate: + """Update a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the update certificate operation. Required. + :type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + certificate_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Certificate: + """Update a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the update certificate operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + certificate_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Certificate: + """Update a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the update certificate operation. 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: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + certificate_name: str, + parameters: Union[_models.CertificateUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Certificate: + """Update a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the update certificate operation. Is one of the + following types: CertificateUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters or JSON or + IO[bytes] + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_certificate_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Certificate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, automation_account_name: str, certificate_name: str, **kwargs: Any + ) -> None: + """Delete the certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_certificate_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Certificate"]: + """Retrieve a list of certificates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Certificate + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Certificate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Certificate]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_certificate_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Certificate], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`connection` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, connection_name: str, **kwargs: Any + ) -> _models.Connection: + """Retrieve the connection identified by connection name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + + _request = build_connection_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Connection, response.json()) + + 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, + connection_name: str, + parameters: _models.ConnectionCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Connection: + """Create or update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the create or update connection operation. + Required. + :type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + connection_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Connection: + """Create or update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the create or update connection operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Connection: + """Create or update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the create or update connection operation. + 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: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + connection_name: str, + parameters: Union[_models.ConnectionCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Connection: + """Create or update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the create or update connection operation. Is one + of the following types: ConnectionCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connection_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Connection, response.json()) + + 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, + connection_name: str, + parameters: _models.ConnectionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Connection: + """Update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the update a connection operation. Required. + :type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + connection_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Connection: + """Update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the update a connection operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Connection: + """Update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the update a connection operation. 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: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + connection_name: str, + parameters: Union[_models.ConnectionUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Connection: + """Update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the update a connection operation. Is one of the + following types: ConnectionUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters or JSON or IO[bytes] + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connection_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Connection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, automation_account_name: str, connection_name: str, **kwargs: Any + ) -> None: + """Delete the connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_connection_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Connection"]: + """Retrieve a list of connections. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Connection + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Connection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_connection_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Connection], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ConnectionTypeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`connection_type` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, connection_type_name: str, **kwargs: Any + ) -> _models.ConnectionType: + """Retrieve the connection type identified by connection type name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_type_name: The name of connection type. Required. + :type connection_type_name: str + :return: ConnectionType. The ConnectionType is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.ConnectionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) + + _request = build_connection_type_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_type_name=connection_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ConnectionType, response.json()) + + 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, + connection_type_name: str, + parameters: _models.ConnectionTypeCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionType: + """Create a connection type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_type_name: The name of connection type. Required. + :type connection_type_name: str + :param parameters: The parameters supplied to the create or update connection type operation. + Required. + :type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionType. The ConnectionType is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.ConnectionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + connection_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionType: + """Create a connection type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_type_name: The name of connection type. Required. + :type connection_type_name: str + :param parameters: The parameters supplied to the create or update connection type operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionType. The ConnectionType is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.ConnectionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + connection_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionType: + """Create a connection type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_type_name: The name of connection type. Required. + :type connection_type_name: str + :param parameters: The parameters supplied to the create or update connection type operation. + 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: ConnectionType. The ConnectionType is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.ConnectionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + connection_type_name: str, + parameters: Union[_models.ConnectionTypeCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ConnectionType: + """Create a connection type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_type_name: The name of connection type. Required. + :type connection_type_name: str + :param parameters: The parameters supplied to the create or update connection type operation. + Is one of the following types: ConnectionTypeCreateOrUpdateParameters, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters or JSON + or IO[bytes] + :return: ConnectionType. The ConnectionType is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.ConnectionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connection_type_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_type_name=connection_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ConnectionType, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, automation_account_name: str, connection_type_name: str, **kwargs: Any + ) -> None: + """Delete the connection type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_type_name: The name of connection type. Required. + :type connection_type_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_connection_type_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_type_name=connection_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ConnectionType"]: + """Retrieve a list of connection types. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of ConnectionType + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ConnectionType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ConnectionType]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_connection_type_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ConnectionType], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CredentialOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`credential` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, credential_name: str, **kwargs: Any + ) -> _models.Credential: + """Retrieve the credential identified by credential name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Credential] = kwargs.pop("cls", None) + + _request = build_credential_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + credential_name=credential_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Credential, response.json()) + + 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, + credential_name: str, + parameters: _models.CredentialCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Credential: + """Create a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the create or update credential operation. + Required. + :type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + credential_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Credential: + """Create a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the create or update credential operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + credential_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Credential: + """Create a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the create or update credential operation. + 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: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + credential_name: str, + parameters: Union[_models.CredentialCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Credential: + """Create a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the create or update credential operation. Is one + of the following types: CredentialCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Credential] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_credential_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + credential_name=credential_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Credential, response.json()) + + 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, + credential_name: str, + parameters: _models.CredentialUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Credential: + """Update a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the Update credential operation. Required. + :type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + credential_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Credential: + """Update a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the Update credential operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + credential_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Credential: + """Update a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the Update credential operation. 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: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + credential_name: str, + parameters: Union[_models.CredentialUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Credential: + """Update a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the Update credential operation. Is one of the + following types: CredentialUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters or JSON or IO[bytes] + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Credential] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_credential_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + credential_name=credential_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Credential, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, automation_account_name: str, credential_name: str, **kwargs: Any + ) -> None: + """Delete the credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_credential_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + credential_name=credential_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Credential"]: + """Retrieve a list of credentials. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Credential + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Credential] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Credential]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_credential_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Credential], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DscConfigurationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`dsc_configuration` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, configuration_name: str, **kwargs: Any + ) -> _models.DscConfiguration: + """Retrieve the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) + + _request = build_dsc_configuration_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscConfiguration, response.json()) + + 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, + configuration_name: str, + parameters: _models.DscConfigurationCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Required. + :type parameters: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + configuration_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + configuration_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. 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: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + configuration_name: str, + parameters: Union[_models.DscConfigurationCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Is one of the following + types: DscConfigurationCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters or + JSON or IO[bytes] + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dsc_configuration_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscConfiguration, response.json()) + + 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, + configuration_name: str, + parameters: Optional[_models.DscConfigurationUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Default value is None. + :type parameters: ~azure.mgmt.automation.models.DscConfigurationUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + configuration_name: str, + parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Default value is None. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + configuration_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Default value is None. + :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: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + configuration_name: str, + parameters: Optional[Union[_models.DscConfigurationUpdateParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Is one of the following + types: DscConfigurationUpdateParameters, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.automation.models.DscConfigurationUpdateParameters or JSON or + IO[bytes] + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_dsc_configuration_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_dsc_configuration_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, + resource_group_name: str, + automation_account_name: str, + *, + filter: Optional[str] = None, + skip: Optional[int] = None, + top: Optional[int] = None, + inlinecount: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.DscConfiguration"]: + """Retrieve a list of configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword skip: The number of rows to skip. Default value is None. + :paramtype skip: int + :keyword top: The number of rows to take. Default value is None. + :paramtype top: int + :keyword inlinecount: Return total rows. Default value is None. + :paramtype inlinecount: str + :return: An iterator like instance of DscConfiguration + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DscConfiguration]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dsc_configuration_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + skip=skip, + top=top, + inlinecount=inlinecount, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DscConfiguration], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_content( + self, resource_group_name: str, automation_account_name: str, configuration_name: str, **kwargs: Any + ) -> str: + """Retrieve the configuration script identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_dsc_configuration_get_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class DscNodeConfigurationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`dsc_node_configuration` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, node_configuration_name: str, **kwargs: Any + ) -> _models.DscNodeConfiguration: + """Retrieve the Dsc node configurations by node configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_configuration_name: The Dsc node configuration name. Required. + :type node_configuration_name: str + :return: DscNodeConfiguration. The DscNodeConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNodeConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DscNodeConfiguration] = kwargs.pop("cls", None) + + _request = build_dsc_node_configuration_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_configuration_name=node_configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscNodeConfiguration, response.json()) + + 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, + node_configuration_name: str, + parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dsc_node_configuration_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_configuration_name=node_configuration_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + node_configuration_name: str, + parameters: _models.DscNodeConfigurationCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DscNodeConfiguration]: + """Create the node configuration identified by node configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_configuration_name: The Dsc node configuration name. Required. + :type node_configuration_name: str + :param parameters: The create or update parameters for configuration. Required. + :type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters + :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 DscNodeConfiguration. The + DscNodeConfiguration is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + node_configuration_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DscNodeConfiguration]: + """Create the node configuration identified by node configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_configuration_name: The Dsc node configuration name. Required. + :type node_configuration_name: str + :param parameters: The create or update parameters for configuration. Required. + :type parameters: JSON + :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 DscNodeConfiguration. The + DscNodeConfiguration is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + node_configuration_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DscNodeConfiguration]: + """Create the node configuration identified by node configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_configuration_name: The Dsc node configuration name. Required. + :type node_configuration_name: str + :param parameters: The create or update parameters for configuration. 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 DscNodeConfiguration. The + DscNodeConfiguration is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + node_configuration_name: str, + parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DscNodeConfiguration]: + """Create the node configuration identified by node configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_configuration_name: The Dsc node configuration name. Required. + :type node_configuration_name: str + :param parameters: The create or update parameters for configuration. Is one of the following + types: DscNodeConfigurationCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DscNodeConfiguration. The + DscNodeConfiguration is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DscNodeConfiguration] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("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, + node_configuration_name=node_configuration_name, + parameters=parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DscNodeConfiguration, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DscNodeConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DscNodeConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_configuration_name: The Dsc node configuration name. Required. + :type node_configuration_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_dsc_node_configuration_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_configuration_name=node_configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, + resource_group_name: str, + automation_account_name: str, + *, + filter: Optional[str] = None, + skip: Optional[int] = None, + top: Optional[int] = None, + inlinecount: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.DscNodeConfiguration"]: + """Retrieve a list of dsc node configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword skip: The number of rows to skip. Default value is None. + :paramtype skip: int + :keyword top: The number of rows to take. Default value is None. + :paramtype top: int + :keyword inlinecount: Return total rows. Default value is None. + :paramtype inlinecount: str + :return: An iterator like instance of DscNodeConfiguration + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscNodeConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DscNodeConfiguration]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dsc_node_configuration_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + skip=skip, + top=top, + inlinecount=inlinecount, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DscNodeConfiguration], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class HybridRunbookWorkerGroupOperations: + """ + .. 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_worker_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Retrieve a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. + :type hybrid_runbook_worker_group_name: str + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) + + _request = build_hybrid_runbook_worker_group_get_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridRunbookWorkerGroup, response.json()) + + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Create a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :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, JSON, IO[bytes] + ], + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Create a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 one of the following types: + HybridRunbookWorkerGroupCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type hybrid_runbook_worker_group_creation_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or JSON or + IO[bytes] + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(hybrid_runbook_worker_group_creation_parameters, (IOBase, bytes)): + _content = hybrid_runbook_worker_group_creation_parameters + else: + _content = json.dumps(hybrid_runbook_worker_group_creation_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hybrid_runbook_worker_group_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridRunbookWorkerGroup, response.json()) + + 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, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_group_updation_parameters: _models.HybridRunbookWorkerGroupCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Update a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_group_updation_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Update a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_group_updation_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Update a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_group_updation_parameters: Union[ + _models.HybridRunbookWorkerGroupCreateOrUpdateParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Update a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 one + of the following types: HybridRunbookWorkerGroupCreateOrUpdateParameters, JSON, IO[bytes] + Required. + :type hybrid_runbook_worker_group_updation_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or JSON or + IO[bytes] + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(hybrid_runbook_worker_group_updation_parameters, (IOBase, bytes)): + _content = hybrid_runbook_worker_group_updation_parameters + else: + _content = json.dumps(hybrid_runbook_worker_group_updation_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hybrid_runbook_worker_group_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridRunbookWorkerGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + **kwargs: Any + ) -> None: + """Delete a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. + :type hybrid_runbook_worker_group_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_hybrid_runbook_worker_group_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.HybridRunbookWorkerGroup"]: + """Retrieve a list of hybrid runbook worker groups. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of HybridRunbookWorkerGroup + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.HybridRunbookWorkerGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.HybridRunbookWorkerGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_hybrid_runbook_worker_group_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.HybridRunbookWorkerGroup], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class JobStreamOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`job_stream` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + job_stream_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.JobStream: + """Retrieve the job stream identified by job stream id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :param job_stream_id: The job stream id. Required. + :type job_stream_id: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: JobStream. The JobStream is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobStream + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) + + _request = build_job_stream_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + job_stream_id=job_stream_id, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.JobStream, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_job( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + filter: Optional[str] = None, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.JobStream"]: + """Retrieve a list of jobs streams identified by job name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: An iterator like instance of JobStream + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobStream] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.JobStream]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_job_stream_list_by_job_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + filter=filter, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.JobStream], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class JobScheduleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`job_schedule` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, job_schedule_id: str, **kwargs: Any + ) -> _models.JobSchedule: + """Retrieve the job schedule identified by job schedule name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_schedule_id: The job schedule name. Required. + :type job_schedule_id: str + :return: JobSchedule. The JobSchedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) + + _request = build_job_schedule_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_schedule_id=job_schedule_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.JobSchedule, response.json()) + + 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, + job_schedule_id: str, + parameters: _models.JobScheduleCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.JobSchedule: + """Create a job schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_schedule_id: The job schedule name. Required. + :type job_schedule_id: str + :param parameters: The parameters supplied to the create job schedule operation. Required. + :type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JobSchedule. The JobSchedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + job_schedule_id: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.JobSchedule: + """Create a job schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_schedule_id: The job schedule name. Required. + :type job_schedule_id: str + :param parameters: The parameters supplied to the create job schedule operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JobSchedule. The JobSchedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + job_schedule_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.JobSchedule: + """Create a job schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_schedule_id: The job schedule name. Required. + :type job_schedule_id: str + :param parameters: The parameters supplied to the create job schedule operation. 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: JobSchedule. The JobSchedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + automation_account_name: str, + job_schedule_id: str, + parameters: Union[_models.JobScheduleCreateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.JobSchedule: + """Create a job schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_schedule_id: The job schedule name. Required. + :type job_schedule_id: str + :param parameters: The parameters supplied to the create job schedule operation. Is one of the + following types: JobScheduleCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters or JSON or + IO[bytes] + :return: JobSchedule. The JobSchedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_job_schedule_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_schedule_id=job_schedule_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.JobSchedule, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_schedule_id: The job schedule name. Required. + :type job_schedule_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_job_schedule_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_schedule_id=job_schedule_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.JobSchedule"]: + """Retrieve a list of job schedules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of JobSchedule + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobSchedule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.JobSchedule]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_job_schedule_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.JobSchedule], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ModuleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`module` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any + ) -> _models.Module: + """Retrieve the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Module] = kwargs.pop("cls", None) + + _request = build_module_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + 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, + module_name: str, + parameters: _models.ModuleCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The create or update parameters for module. Required. + :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The create or update parameters for module. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The create or update parameters for module. 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. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: Union[_models.ModuleCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The create or update parameters for module. Is one of the following types: + ModuleCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_module_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + 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, + module_name: str, + parameters: _models.ModuleUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The update parameters for module. Required. + :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The update parameters for module. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The update parameters for module. 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. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: Union[_models.ModuleUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The update parameters for module. Is one of the following types: + ModuleUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters or JSON or IO[bytes] + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_module_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any + ) -> None: + """Delete the module by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_module_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Module"]: + """Retrieve a list of modules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Module + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Module] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Module]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_module_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Module], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ActivityOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`activity` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + activity_name: str, + **kwargs: Any + ) -> _models.Activity: + """Retrieve the activity in the module identified by module name and activity name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param activity_name: The name of activity. Required. + :type activity_name: str + :return: Activity. The Activity is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Activity + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Activity] = kwargs.pop("cls", None) + + _request = build_activity_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + activity_name=activity_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Activity, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_module( + self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Activity"]: + """Retrieve a list of activities in the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :return: An iterator like instance of Activity + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Activity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Activity]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_activity_list_by_module_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Activity], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class FieldsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`fields` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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 + ) -> AsyncItemPaged["_models.TypeField"]: + """Retrieve a list of fields of a given type identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param type_name: The name of type. Required. + :type type_name: str + :return: An iterator like instance of TypeField + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.TypeField] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TypeField]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_fields_list_by_type_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + type_name=type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.TypeField], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class PackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`package` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + **kwargs: Any + ) -> _models.Package: + """Retrieve the Package identified by Package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Package] = kwargs.pop("cls", None) + + _request = build_package_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Package, response.json()) + + 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, + runtime_environment_name: str, + package_name: str, + parameters: _models.PackageCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The create or update parameters for Package. Required. + :type parameters: ~azure.mgmt.automation.models.PackageCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The create or update parameters for Package. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The create or update parameters for 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: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: Union[_models.PackageCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The create or update parameters for Package. Is one of the following types: + PackageCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.PackageCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Package] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_package_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Package, response.json()) + + 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, + runtime_environment_name: str, + package_name: str, + parameters: _models.PackageUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The update parameters for Package. Required. + :type parameters: ~azure.mgmt.automation.models.PackageUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The update parameters for Package. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The update parameters for 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: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: Union[_models.PackageUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The update parameters for Package. Is one of the following types: + PackageUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.PackageUpdateParameters or JSON or IO[bytes] + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Package] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_package_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Package, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + **kwargs: Any + ) -> None: + """Delete the package by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_package_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_runtime_environment( + self, resource_group_name: str, automation_account_name: str, runtime_environment_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Package"]: + """Retrieve the a list of Packages. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :return: An iterator like instance of Package + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Package] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Package]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_package_list_by_runtime_environment_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Package], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class RunbookOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`runbook` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> _models.Runbook: + """Retrieve the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) + + _request = build_runbook_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Runbook, response.json()) + + 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, + runbook_name: str, + parameters: _models.RunbookCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Runbook: + """Create the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The create or update parameters for runbook. Provide either content link for + a published runbook or draft, not both. Required. + :type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Runbook: + """Create the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The create or update parameters for runbook. Provide either content link for + a published runbook or draft, not both. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Runbook: + """Create the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The create or update parameters for runbook. Provide either content link for + a published runbook or draft, not both. 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: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: Union[_models.RunbookCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Runbook: + """Create the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The create or update parameters for runbook. Provide either content link for + a published runbook or draft, not both. Is one of the following types: + RunbookCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_runbook_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Runbook, response.json()) + + 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, + runbook_name: str, + parameters: _models.RunbookUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Runbook: + """Update the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The update parameters for runbook. Required. + :type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Runbook: + """Update the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The update parameters for runbook. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Runbook: + """Update the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The update parameters for 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: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: Union[_models.RunbookUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Runbook: + """Update the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The update parameters for runbook. Is one of the following types: + RunbookUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters or JSON or IO[bytes] + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_runbook_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Runbook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> None: + """Delete the runbook by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_runbook_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Runbook"]: + """Retrieve a list of runbooks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Runbook + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Runbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Runbook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_runbook_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Runbook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _publish_initial( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_runbook_publish_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_publish( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish runbook draft. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._publish_initial( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get_content( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> str: + """Retrieve the content of runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_runbook_get_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class RunbookDraftOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`runbook_draft` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> str: + """Retrieve the content of runbook draft identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_runbook_draft_get_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def _replace_content_initial( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + runbook_content: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "text/plain")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _content = runbook_content + + _request = build_runbook_draft_replace_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_replace_content( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + runbook_content: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Replaces the runbook draft content. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param runbook_content: The runbook draft content. Required. + :type runbook_content: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "text/plain")) + cls: 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._replace_content_initial( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + runbook_content=runbook_content, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> _models.RunbookDraft: + """Retrieve the runbook draft identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: RunbookDraft. The RunbookDraft is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RunbookDraft + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RunbookDraft] = kwargs.pop("cls", None) + + _request = build_runbook_draft_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RunbookDraft, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def undo_edit( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> _models.RunbookDraftUndoEditResult: + """Undo draft edit to last known published state identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: RunbookDraftUndoEditResult. The RunbookDraftUndoEditResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.RunbookDraftUndoEditResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RunbookDraftUndoEditResult] = kwargs.pop("cls", None) + + _request = build_runbook_draft_undo_edit_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RunbookDraftUndoEditResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class TestJobStreamsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`test_job_streams` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + job_stream_id: str, + **kwargs: Any + ) -> _models.JobStream: + """Retrieve a test job stream of the test job identified by runbook name and stream id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param job_stream_id: The job stream id. Required. + :type job_stream_id: str + :return: JobStream. The JobStream is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobStream + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) + + _request = build_test_job_streams_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + job_stream_id=job_stream_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.JobStream, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_test_job( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.JobStream"]: + """Retrieve a list of test job streams identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of JobStream + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobStream] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.JobStream]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_test_job_streams_list_by_test_job_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.JobStream], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class TestJobOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`test_job` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: _models.TestJobCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TestJob: + """Create a test job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The parameters supplied to the create test job operation. Required. + :type parameters: ~azure.mgmt.automation.models.TestJobCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TestJob. The TestJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.TestJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TestJob: + """Create a test job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The parameters supplied to the create test job operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TestJob. The TestJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.TestJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TestJob: + """Create a test job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The parameters supplied to the create test job operation. 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: TestJob. The TestJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.TestJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: Union[_models.TestJobCreateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.TestJob: + """Create a test job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The parameters supplied to the create test job operation. Is one of the + following types: TestJobCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.TestJobCreateParameters or JSON or IO[bytes] + :return: TestJob. The TestJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.TestJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_test_job_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TestJob, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> _models.TestJob: + """Retrieve the test job for the specified runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: TestJob. The TestJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.TestJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) + + _request = build_test_job_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TestJob, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def resume( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> None: + """Resume the test job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_test_job_resume_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> None: + """Stop the test job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_test_job_stop_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> None: + """Suspend the test job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_test_job_suspend_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class ScheduleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`schedule` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, schedule_name: str, **kwargs: Any + ) -> _models.Schedule: + """Retrieve the schedule identified by schedule name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) + + _request = build_schedule_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + schedule_name=schedule_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Schedule, response.json()) + + 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, + schedule_name: str, + parameters: _models.ScheduleCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.Schedule]: + """Create a schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the create or update schedule operation. + Required. + :type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Schedule or None. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + schedule_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.Schedule]: + """Create a schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the create or update schedule operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Schedule or None. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + schedule_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.Schedule]: + """Create a schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the create or update schedule operation. + 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: Schedule or None. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + schedule_name: str, + parameters: Union[_models.ScheduleCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.Schedule]: + """Create a schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the create or update schedule operation. Is one + of the following types: ScheduleCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Schedule or None. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Schedule]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_schedule_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + schedule_name=schedule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 409]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Schedule, response.json()) + + 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, + schedule_name: str, + parameters: _models.ScheduleUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Schedule: + """Update the schedule identified by schedule name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the update schedule operation. Required. + :type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + schedule_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Schedule: + """Update the schedule identified by schedule name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the update schedule operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + schedule_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Schedule: + """Update the schedule identified by schedule name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the update schedule operation. 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: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + schedule_name: str, + parameters: Union[_models.ScheduleUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Schedule: + """Update the schedule identified by schedule name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the update schedule operation. Is one of the + following types: ScheduleUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters or JSON or IO[bytes] + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_schedule_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + schedule_name=schedule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Schedule, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_schedule_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + schedule_name=schedule_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Schedule"]: + """Retrieve a list of schedules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Schedule + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Schedule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Schedule]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_schedule_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Schedule], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class SourceControlOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`source_control` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, source_control_name: str, **kwargs: Any + ) -> _models.SourceControl: + """Retrieve the source control identified by source control name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) + + _request = build_source_control_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SourceControl, response.json()) + + 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, + source_control_name: str, + parameters: _models.SourceControlCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Create a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the create or update source control operation. + Required. + :type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Create a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the create or update source control operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Create a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the create or update source control operation. + 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: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + parameters: Union[_models.SourceControlCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SourceControl: + """Create a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the create or update source control operation. Is + one of the following types: SourceControlCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters or JSON + or IO[bytes] + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_source_control_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SourceControl, response.json()) + + 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, + source_control_name: str, + parameters: _models.SourceControlUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Update a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the update source control operation. Required. + :type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Update a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the update source control operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Update a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the update source control operation. 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: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + parameters: Union[_models.SourceControlUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SourceControl: + """Update a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the update source control operation. Is one of + the following types: SourceControlUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters or JSON or + IO[bytes] + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_source_control_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SourceControl, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, automation_account_name: str, source_control_name: str, **kwargs: Any + ) -> None: + """Delete the source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_source_control_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.SourceControl"]: + """Retrieve a list of source controls. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of SourceControl + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.SourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SourceControl]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_source_control_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SourceControl], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class SourceControlSyncJobOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`source_control_sync_job` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + parameters: _models.SourceControlSyncJobCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControlSyncJob: + """Creates the sync job for a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :param parameters: The parameters supplied to the create source control sync job operation. + Required. + :type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SourceControlSyncJob. The SourceControlSyncJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControlSyncJob: + """Creates the sync job for a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :param parameters: The parameters supplied to the create source control sync job operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SourceControlSyncJob. The SourceControlSyncJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControlSyncJob: + """Creates the sync job for a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :param parameters: The parameters supplied to the create source control sync job operation. + 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: SourceControlSyncJob. The SourceControlSyncJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + parameters: Union[_models.SourceControlSyncJobCreateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SourceControlSyncJob: + """Creates the sync job for a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :param parameters: The parameters supplied to the create source control sync job operation. Is + one of the following types: SourceControlSyncJobCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters or JSON or + IO[bytes] + :return: SourceControlSyncJob. The SourceControlSyncJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SourceControlSyncJob] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_source_control_sync_job_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + source_control_sync_job_id=source_control_sync_job_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SourceControlSyncJob, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + **kwargs: Any + ) -> _models.SourceControlSyncJobById: + """Retrieve the source control sync job identified by job id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :return: SourceControlSyncJobById. The SourceControlSyncJobById is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobById + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SourceControlSyncJobById] = kwargs.pop("cls", None) + + _request = build_source_control_sync_job_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + source_control_sync_job_id=source_control_sync_job_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SourceControlSyncJobById, response.json()) + + 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, + source_control_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.SourceControlSyncJob"]: + """Retrieve a list of source control sync jobs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of SourceControlSyncJob + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.SourceControlSyncJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SourceControlSyncJob]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_source_control_sync_job_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SourceControlSyncJob], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class SourceControlSyncJobStreamsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`source_control_sync_job_streams` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.SourceControlSyncJobStream"]: + """Retrieve a list of sync job streams identified by sync job id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of SourceControlSyncJobStream + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.SourceControlSyncJobStream] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SourceControlSyncJobStream]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_source_control_sync_job_streams_list_by_sync_job_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + source_control_sync_job_id=source_control_sync_job_id, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SourceControlSyncJobStream], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + stream_id: str, + **kwargs: Any + ) -> _models.SourceControlSyncJobStreamById: + """Retrieve a sync job stream identified by stream id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :param stream_id: The id of the sync job stream. Required. + :type stream_id: str + :return: SourceControlSyncJobStreamById. The SourceControlSyncJobStreamById is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobStreamById + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SourceControlSyncJobStreamById] = kwargs.pop("cls", None) + + _request = build_source_control_sync_job_streams_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + source_control_sync_job_id=source_control_sync_job_id, + stream_id=stream_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SourceControlSyncJobStreamById, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class VariableOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`variable` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, variable_name: str, **kwargs: Any + ) -> _models.Variable: + """Retrieve the variable identified by variable name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Variable] = kwargs.pop("cls", None) + + _request = build_variable_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + variable_name=variable_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Variable, response.json()) + + 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, + variable_name: str, + parameters: _models.VariableCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Variable: + """Create a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the create or update variable operation. + Required. + :type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + variable_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Variable: + """Create a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the create or update variable operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + variable_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Variable: + """Create a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the create or update variable operation. + 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: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + variable_name: str, + parameters: Union[_models.VariableCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Variable: + """Create a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the create or update variable operation. Is one + of the following types: VariableCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Variable] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_variable_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + variable_name=variable_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Variable, response.json()) + + 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, + variable_name: str, + parameters: _models.VariableUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Variable: + """Update a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the update variable operation. Required. + :type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + variable_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Variable: + """Update a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the update variable operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + variable_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Variable: + """Update a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the update variable operation. 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: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + variable_name: str, + parameters: Union[_models.VariableUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Variable: + """Update a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the update variable operation. Is one of the + following types: VariableUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters or JSON or IO[bytes] + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Variable] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_variable_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + variable_name=variable_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Variable, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, automation_account_name: str, variable_name: str, **kwargs: Any + ) -> None: + """Delete the variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_variable_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + variable_name=variable_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Variable"]: + """Retrieve a list of variables. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Variable + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Variable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Variable]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_variable_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Variable], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class WatcherOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`watcher` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any + ) -> _models.Watcher: + """Retrieve the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) + + _request = build_watcher_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + watcher_name=watcher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Watcher, response.json()) + + 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, + watcher_name: str, + parameters: _models.Watcher, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Watcher: + """Create the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The create or update parameters for watcher. Required. + :type parameters: ~azure.mgmt.automation.models.Watcher + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + watcher_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Watcher: + """Create the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The create or update parameters for watcher. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + watcher_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Watcher: + """Create the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The create or update parameters for watcher. 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: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + watcher_name: str, + parameters: Union[_models.Watcher, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Watcher: + """Create the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The create or update parameters for watcher. Is one of the following types: + Watcher, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.Watcher or JSON or IO[bytes] + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_watcher_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + watcher_name=watcher_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Watcher, response.json()) + + 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, + watcher_name: str, + parameters: _models.WatcherUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Watcher: + """Update the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The update parameters for watcher. Required. + :type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + watcher_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Watcher: + """Update the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The update parameters for watcher. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + watcher_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Watcher: + """Update the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The update parameters for watcher. 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: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + watcher_name: str, + parameters: Union[_models.WatcherUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Watcher: + """Update the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The update parameters for watcher. Is one of the following types: + WatcherUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters or JSON or IO[bytes] + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_watcher_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + watcher_name=watcher_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Watcher, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any + ) -> None: + """Delete the watcher by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_watcher_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + watcher_name=watcher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Watcher"]: + """Retrieve a list of watchers. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of Watcher + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Watcher] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Watcher]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_watcher_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Watcher], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_watcher_start_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + watcher_name=watcher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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( + self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any + ) -> None: + """Resume the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_watcher_stop_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + watcher_name=watcher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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_subscription(self, **kwargs: Any) -> _models.DeletedAutomationAccountListResult: + """Retrieve deleted automation account. + + :return: DeletedAutomationAccountListResult. The DeletedAutomationAccountListResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DeletedAutomationAccountListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeletedAutomationAccountListResult] = kwargs.pop("cls", None) + + _request = build_deleted_automation_accounts_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DeletedAutomationAccountListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class _AutomationClientOperationsMixin( + ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], AutomationClientConfiguration] +): + + @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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The GraphicalRunbookContent is compatible with MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.GraphicalRunbookContent: + """Post operation to serialize or deserialize GraphRunbookContent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Input data describing the graphical runbook. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: GraphicalRunbookContent. The GraphicalRunbookContent is compatible with MutableMapping + :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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The GraphicalRunbookContent is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.GraphicalRunbookContent: + """Post operation to serialize or deserialize GraphRunbookContent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Input data describing the graphical runbook. Is one of the following types: + GraphicalRunbookContent, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.GraphicalRunbookContent or JSON or IO[bytes] + :return: GraphicalRunbookContent. The GraphicalRunbookContent is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.GraphicalRunbookContent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_automation_convert_graph_runbook_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.GraphicalRunbookContent, response.json()) + + 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/_patch.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_patch.py index 49900f6ab120..ea765788358a 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 @@ -1,15 +1,14 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): 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 deleted file mode 100644 index 0e04953a4e07..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python2_package_operations.py +++ /dev/null @@ -1,568 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._python2_package_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_automation_account_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class Python2PackageOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`python2_package` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, package_name: str, **kwargs: Any - ) -> None: - """Delete the python 2 package by name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - 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]: - map_error(status_code=response.status_code, 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The name of python package. Required. - :type package_name: str - :param parameters: The create or update parameters for python package. 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The name of python package. Required. - :type package_name: str - :param parameters: The create or update parameters for python package. 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The name of python package. Required. - :type package_name: str - :param parameters: The create or update parameters for python package. Is either a - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The name of python package. Required. - :type package_name: str - :param parameters: The update parameters for python package. 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The name of python package. Required. - :type package_name: str - :param parameters: The update parameters for python package. 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The name of python package. Required. - :type package_name: str - :param parameters: The update parameters for python package. Is either a - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - 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 - ) -> AsyncItemPaged["_models.Module"]: - """Retrieve a list of python 2 packages. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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", "2018-06-30")) - cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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 deleted file mode 100644 index b9ca9bce2b03..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_draft_operations.py +++ /dev/null @@ -1,405 +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 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, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class RunbookDraftOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`runbook_draft` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - """Retrieve the content of runbook draft identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookdraftoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: AsyncIterator[bytes] or the result of cls(response) - :rtype: AsyncIterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_get_content_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _replace_content_initial( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - runbook_content: IO[bytes], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _content = runbook_content - - _request = build_replace_content_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_replace_content( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - runbook_content: IO[bytes], - **kwargs: Any - ) -> AsyncLROPoller[AsyncIterator[bytes]]: - """Replaces the runbook draft content. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookdraftoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :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) - :rtype: ~azure.core.polling.AsyncLROPoller[AsyncIterator[bytes]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._replace_content_initial( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_name, - runbook_content=runbook_content, - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - 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[AsyncIterator[bytes]].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[AsyncIterator[bytes]]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> _models.RunbookDraft: - """Retrieve the runbook draft identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookdraftoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: RunbookDraft or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.RunbookDraft - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.RunbookDraft] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("RunbookDraft", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def undo_edit( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> _models.RunbookDraftUndoEditResult: - """Undo draft edit to last known published state identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookdraftoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: RunbookDraftUndoEditResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.RunbookDraftUndoEditResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.RunbookDraftUndoEditResult] = kwargs.pop("cls", None) - - _request = build_undo_edit_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("RunbookDraftUndoEditResult", 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/_runbook_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_operations.py deleted file mode 100644 index 3bfb8d004f41..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_operations.py +++ /dev/null @@ -1,762 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._runbook_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_content_request, - build_get_request, - build_list_by_automation_account_request, - build_publish_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class RunbookOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`runbook` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_publish_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_publish( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Publish runbook draft. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookdraftoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The parameters supplied to the publish runbook operation. Required. - :type runbook_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", "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) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._publish_initial( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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 - - @distributed_trace_async - async def get_content( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - """Retrieve the content of runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: AsyncIterator[bytes] or the result of cls(response) - :rtype: AsyncIterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_get_content_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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 = 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 get( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> _models.Runbook: - """Retrieve the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("Runbook", 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, - runbook_name: str, - parameters: _models.RunbookCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Runbook: - """Create the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param parameters: The create or update parameters for runbook. Provide either content link for - a published runbook or draft, not both. Required. - :type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Runbook: - """Create the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param parameters: The create or update parameters for runbook. Provide either content link for - a published runbook or draft, not both. 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: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: Union[_models.RunbookCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Runbook: - """Create the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param parameters: The create or update parameters for runbook. Provide either content link for - a published runbook or draft, not both. Is either a RunbookCreateOrUpdateParameters type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters or IO[bytes] - :return: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RunbookCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("Runbook", 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, - runbook_name: str, - parameters: _models.RunbookUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Runbook: - """Update the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param parameters: The update parameters for runbook. Required. - :type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Runbook: - """Update the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param parameters: The update parameters for runbook. 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: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: Union[_models.RunbookUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Runbook: - """Update the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param parameters: The update parameters for runbook. Is either a RunbookUpdateParameters type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters or IO[bytes] - :return: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RunbookUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("Runbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> None: - """Delete the runbook by name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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 - def list_by_automation_account( - self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.Runbook"]: - """Retrieve a list of runbooks. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Runbook or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Runbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.RunbookListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("RunbookListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_schedule_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_schedule_operations.py deleted file mode 100644 index 844bb805ec41..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_schedule_operations.py +++ /dev/null @@ -1,571 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._schedule_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_automation_account_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ScheduleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`schedule` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - schedule_name: str, - parameters: _models.ScheduleCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.Schedule]: - """Create a schedule. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :param parameters: The parameters supplied to the create or update schedule operation. - Required. - :type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Schedule or None or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - schedule_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.Schedule]: - """Create a schedule. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :param parameters: The parameters supplied to the create or update schedule operation. - 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: Schedule or None or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - schedule_name: str, - parameters: Union[_models.ScheduleCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.Schedule]: - """Create a schedule. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :param parameters: The parameters supplied to the create or update schedule operation. Is - either a ScheduleCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters or IO[bytes] - :return: Schedule or None or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ScheduleCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - schedule_name=schedule_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, 409]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - deserialized = self._deserialize("Schedule", 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, - schedule_name: str, - parameters: _models.ScheduleUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Schedule: - """Update the schedule identified by schedule name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :param parameters: The parameters supplied to the update schedule operation. Required. - :type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Schedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - schedule_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Schedule: - """Update the schedule identified by schedule name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :param parameters: The parameters supplied to the update schedule operation. 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: Schedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - automation_account_name: str, - schedule_name: str, - parameters: Union[_models.ScheduleUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Schedule: - """Update the schedule identified by schedule name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :param parameters: The parameters supplied to the update schedule operation. Is either a - ScheduleUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters or IO[bytes] - :return: Schedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ScheduleUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - schedule_name=schedule_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("Schedule", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, schedule_name: str, **kwargs: Any - ) -> _models.Schedule: - """Retrieve the schedule identified by schedule name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :return: Schedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - schedule_name=schedule_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("Schedule", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - 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. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - schedule_name=schedule_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_by_automation_account( - self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.Schedule"]: - """Retrieve a list of schedules. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Schedule or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Schedule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("ScheduleListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_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 deleted file mode 100644 index 2241cb560a5a..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_machine_runs_operations.py +++ /dev/null @@ -1,218 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -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 ..._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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SoftwareUpdateConfigurationMachineRunsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`software_update_configuration_machine_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_machine_run_id: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfigurationMachineRun: - """Get a single software update configuration machine run by Id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_machine_run_id: The Id of the software update - configuration machine run. Required. - :type software_update_configuration_machine_run_id: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: SoftwareUpdateConfigurationMachineRun or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - software_update_configuration_machine_run_id=software_update_configuration_machine_run_id, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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("SoftwareUpdateConfigurationMachineRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - automation_account_name: str, - client_request_id: Optional[str] = None, - filter: Optional[str] = None, - skip: Optional[str] = None, - top: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfigurationMachineRunListResult: - """Return list of software update configuration machine runs. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :param filter: The filter to apply on the operation. You can use the following filters: - 'properties/osType', 'properties/status', 'properties/startTime', and - 'properties/softwareUpdateConfiguration/name'. Default value is None. - :type filter: str - :param skip: number of entries you skip before returning results. Default value is None. - :type skip: str - :param top: Maximum number of entries returned in the results collection. Default value is - None. - :type top: str - :return: SoftwareUpdateConfigurationMachineRunListResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRunListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_id, - filter=filter, - skip=skip, - top=top, - 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( - "SoftwareUpdateConfigurationMachineRunListResult", 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/_software_update_configuration_runs_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_runs_operations.py deleted file mode 100644 index 092851ef842a..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_runs_operations.py +++ /dev/null @@ -1,213 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -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 ..._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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SoftwareUpdateConfigurationRunsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`software_update_configuration_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_run_id: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfigurationRun: - """Get a single software update configuration Run by Id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationrunoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_run_id: The Id of the software update configuration run. - Required. - :type software_update_configuration_run_id: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: SoftwareUpdateConfigurationRun or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - software_update_configuration_run_id=software_update_configuration_run_id, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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("SoftwareUpdateConfigurationRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - automation_account_name: str, - client_request_id: Optional[str] = None, - filter: Optional[str] = None, - skip: Optional[str] = None, - top: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfigurationRunListResult: - """Return list of software update configuration runs. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :param filter: The filter to apply on the operation. You can use the following filters: - 'properties/osType', 'properties/status', 'properties/startTime', and - 'properties/softwareUpdateConfiguration/name'. Default value is None. - :type filter: str - :param skip: Number of entries you skip before returning results. Default value is None. - :type skip: str - :param top: Maximum number of entries returned in the results collection. Default value is - None. - :type top: str - :return: SoftwareUpdateConfigurationRunListResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_id, - filter=filter, - skip=skip, - top=top, - 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("SoftwareUpdateConfigurationRunListResult", 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/_software_update_configurations_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configurations_operations.py deleted file mode 100644 index e6c75fcd5cf0..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configurations_operations.py +++ /dev/null @@ -1,442 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -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 ..._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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SoftwareUpdateConfigurationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`software_update_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_name: str, - parameters: _models.SoftwareUpdateConfiguration, - client_request_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SoftwareUpdateConfiguration: - """Create a new software update configuration with the name given in the URI. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_name: The name of the software update configuration to be - created. Required. - :type software_update_configuration_name: str - :param parameters: Request body. Required. - :type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SoftwareUpdateConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_name: str, - parameters: IO[bytes], - client_request_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SoftwareUpdateConfiguration: - """Create a new software update configuration with the name given in the URI. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_name: The name of the software update configuration to be - created. Required. - :type software_update_configuration_name: str - :param parameters: Request body. Required. - :type parameters: IO[bytes] - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SoftwareUpdateConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_name: str, - parameters: Union[_models.SoftwareUpdateConfiguration, IO[bytes]], - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfiguration: - """Create a new software update configuration with the name given in the URI. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_name: The name of the software update configuration to be - created. Required. - :type software_update_configuration_name: str - :param parameters: Request body. Is either a SoftwareUpdateConfiguration type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration or IO[bytes] - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: SoftwareUpdateConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SoftwareUpdateConfiguration") - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - software_update_configuration_name=software_update_configuration_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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("SoftwareUpdateConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_by_name( - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfiguration: - """Get a single software update configuration by name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_name: The name of the software update configuration to be - created. Required. - :type software_update_configuration_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: SoftwareUpdateConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - software_update_configuration_name=software_update_configuration_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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("SoftwareUpdateConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """delete a specific software update configuration. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_name: The name of the software update configuration to be - created. Required. - :type software_update_configuration_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - software_update_configuration_name=software_update_configuration_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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 list( - self, - resource_group_name: str, - automation_account_name: str, - client_request_id: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfigurationListResult: - """Get all software update configurations for the account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :return: SoftwareUpdateConfigurationListResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_id, - filter=filter, - 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("SoftwareUpdateConfigurationListResult", 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/_source_control_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_operations.py deleted file mode 100644 index d3591dcc6e64..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_operations.py +++ /dev/null @@ -1,574 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._source_control_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_automation_account_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SourceControlOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`source_control` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - parameters: _models.SourceControlCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SourceControl: - """Create a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param parameters: The parameters supplied to the create or update source control operation. - Required. - :type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SourceControl: - """Create a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param parameters: The parameters supplied to the create or update source control operation. - 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: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - parameters: Union[_models.SourceControlCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.SourceControl: - """Create a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param parameters: The parameters supplied to the create or update source control operation. Is - either a SourceControlCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters or - IO[bytes] - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SourceControlCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_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("SourceControl", 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, - source_control_name: str, - parameters: _models.SourceControlUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SourceControl: - """Update a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param parameters: The parameters supplied to the update source control operation. Required. - :type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SourceControl: - """Update a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param parameters: The parameters supplied to the update source control operation. 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: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - parameters: Union[_models.SourceControlUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.SourceControl: - """Update a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param parameters: The parameters supplied to the update source control operation. Is either a - SourceControlUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters or IO[bytes] - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SourceControlUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_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("SourceControl", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, resource_group_name: str, automation_account_name: str, source_control_name: str, **kwargs: Any - ) -> None: - """Delete the source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The name of source control. Required. - :type source_control_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, source_control_name: str, **kwargs: Any - ) -> _models.SourceControl: - """Retrieve the source control identified by source control name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The name of source control. Required. - :type source_control_name: str - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_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("SourceControl", 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, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.SourceControl"]: - """Retrieve a list of source controls. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 SourceControl or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.SourceControl] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("SourceControlListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_source_control_sync_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_operations.py deleted file mode 100644 index 8bf92b030103..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_operations.py +++ /dev/null @@ -1,388 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SourceControlSyncJobOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`source_control_sync_job` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: str, - parameters: _models.SourceControlSyncJobCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SourceControlSyncJob: - """Creates the sync job for a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param source_control_sync_job_id: The source control sync job id. Required. - :type source_control_sync_job_id: str - :param parameters: The parameters supplied to the create source control sync job operation. - Required. - :type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SourceControlSyncJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SourceControlSyncJob: - """Creates the sync job for a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param source_control_sync_job_id: The source control sync job id. Required. - :type source_control_sync_job_id: str - :param parameters: The parameters supplied to the create source control sync job operation. - 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: SourceControlSyncJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: str, - parameters: Union[_models.SourceControlSyncJobCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.SourceControlSyncJob: - """Creates the sync job for a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param source_control_sync_job_id: The source control sync job id. Required. - :type source_control_sync_job_id: str - :param parameters: The parameters supplied to the create source control sync job operation. Is - either a SourceControlSyncJobCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters or - IO[bytes] - :return: SourceControlSyncJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SourceControlSyncJobCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_name, - source_control_sync_job_id=source_control_sync_job_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 [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("SourceControlSyncJob", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: str, - **kwargs: Any - ) -> _models.SourceControlSyncJobById: - """Retrieve the source control sync job identified by job id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param source_control_sync_job_id: The source control sync job id. Required. - :type source_control_sync_job_id: str - :return: SourceControlSyncJobById or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobById - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_name, - source_control_sync_job_id=source_control_sync_job_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("SourceControlSyncJobById", 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, - source_control_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.SourceControlSyncJob"]: - """Retrieve a list of source control sync jobs. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_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 SourceControlSyncJob or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.SourceControlSyncJob] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - source_control_name=source_control_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("SourceControlSyncJobListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_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 deleted file mode 100644 index e3017a5e88a6..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_streams_operations.py +++ /dev/null @@ -1,228 +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 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, - 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 ..._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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SourceControlSyncJobStreamsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`source_control_sync_job_streams` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.SourceControlSyncJobStream"]: - """Retrieve a list of sync job streams identified by sync job id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param source_control_sync_job_id: The source control sync job id. Required. - :type source_control_sync_job_id: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :return: An iterator like instance of either SourceControlSyncJobStream or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.SourceControlSyncJobStream] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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_sync_job_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_name, - source_control_sync_job_id=source_control_sync_job_id, - 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("SourceControlSyncJobStreamsListBySyncJob", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: str, - stream_id: str, - **kwargs: Any - ) -> _models.SourceControlSyncJobStreamById: - """Retrieve a sync job stream identified by stream id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param source_control_sync_job_id: The source control sync job id. Required. - :type source_control_sync_job_id: str - :param stream_id: The id of the sync job stream. Required. - :type stream_id: str - :return: SourceControlSyncJobStreamById or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobStreamById - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_name, - source_control_sync_job_id=source_control_sync_job_id, - stream_id=stream_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("SourceControlSyncJobStreamById", 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/_statistics_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_statistics_operations.py deleted file mode 100644 index 12b30cab3e1c..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_statistics_operations.py +++ /dev/null @@ -1,135 +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 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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._statistics_operations import build_list_by_automation_account_request -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class StatisticsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`statistics` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - ) -> AsyncItemPaged["_models.Statistics"]: - """Retrieve the statistics for the account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/statisticsoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 Statistics or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Statistics] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("StatisticsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/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 deleted file mode 100644 index 79a5414400e9..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_operations.py +++ /dev/null @@ -1,462 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -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 ..._utils.serialization import Deserializer, Serializer -from ...operations._test_job_operations import ( - build_create_request, - build_get_request, - build_resume_request, - build_stop_request, - build_suspend_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class TestJobOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`test_job` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: _models.TestJobCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TestJob: - """Create a test job of the runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The parameters supplied to the create test job operation. Required. - :type runbook_name: str - :param parameters: The parameters supplied to the create test job operation. Required. - :type parameters: ~azure.mgmt.automation.models.TestJobCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.TestJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TestJob: - """Create a test job of the runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The parameters supplied to the create test job operation. Required. - :type runbook_name: str - :param parameters: The parameters supplied to the create test job operation. 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: TestJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.TestJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: Union[_models.TestJobCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.TestJob: - """Create a test job of the runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The parameters supplied to the create test job operation. Required. - :type runbook_name: str - :param parameters: The parameters supplied to the create test job operation. Is either a - TestJobCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.TestJobCreateParameters or IO[bytes] - :return: TestJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.TestJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "TestJobCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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 [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("TestJob", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> _models.TestJob: - """Retrieve the test job for the specified runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: TestJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.TestJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("TestJob", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def resume( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> None: - """Resume the test job. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_resume_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def stop( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> None: - """Stop the test job. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def suspend( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> None: - """Suspend the test job. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_suspend_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore 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 deleted file mode 100644 index 900d0a2de473..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_streams_operations.py +++ /dev/null @@ -1,218 +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 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, - 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 ..._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 - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class TestJobStreamsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`test_job_streams` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - job_stream_id: str, - **kwargs: Any - ) -> _models.JobStream: - """Retrieve a test job stream of the test job identified by runbook name and stream id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobstreamoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param job_stream_id: The job stream id. Required. - :type job_stream_id: str - :return: JobStream or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobStream - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_name, - job_stream_id=job_stream_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("JobStream", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_test_job( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.JobStream"]: - """Retrieve a list of test job streams identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobstreamoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_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 JobStream or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobStream] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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_test_job_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("JobStreamListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_usages_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_usages_operations.py deleted file mode 100644 index 60fce1c79274..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_usages_operations.py +++ /dev/null @@ -1,132 +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 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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._usages_operations import build_list_by_automation_account_request -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class UsagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`usages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - ) -> AsyncItemPaged["_models.Usage"]: - """Retrieve the usage for the account id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/usageoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Usage or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Usage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("UsageListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/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 deleted file mode 100644 index 62b991820de2..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_variable_operations.py +++ /dev/null @@ -1,570 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._variable_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_automation_account_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VariableOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`variable` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - variable_name: str, - parameters: _models.VariableCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Variable: - """Create a variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The variable name. Required. - :type variable_name: str - :param parameters: The parameters supplied to the create or update variable operation. - Required. - :type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - variable_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Variable: - """Create a variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The variable name. Required. - :type variable_name: str - :param parameters: The parameters supplied to the create or update variable operation. - 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: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - variable_name: str, - parameters: Union[_models.VariableCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Variable: - """Create a variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The variable name. Required. - :type variable_name: str - :param parameters: The parameters supplied to the create or update variable operation. Is - either a VariableCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters or IO[bytes] - :return: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VariableCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - variable_name=variable_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("Variable", 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, - variable_name: str, - parameters: _models.VariableUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Variable: - """Update a variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The variable name. Required. - :type variable_name: str - :param parameters: The parameters supplied to the update variable operation. Required. - :type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - variable_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Variable: - """Update a variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The variable name. Required. - :type variable_name: str - :param parameters: The parameters supplied to the update variable operation. 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: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - automation_account_name: str, - variable_name: str, - parameters: Union[_models.VariableUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Variable: - """Update a variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The variable name. Required. - :type variable_name: str - :param parameters: The parameters supplied to the update variable operation. Is either a - VariableUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters or IO[bytes] - :return: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VariableUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - variable_name=variable_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("Variable", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, resource_group_name: str, automation_account_name: str, variable_name: str, **kwargs: Any - ) -> None: - """Delete the variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The name of variable. Required. - :type variable_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - variable_name=variable_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, variable_name: str, **kwargs: Any - ) -> _models.Variable: - """Retrieve the variable identified by variable name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The name of variable. Required. - :type variable_name: str - :return: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - variable_name=variable_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("Variable", 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 - ) -> AsyncItemPaged["_models.Variable"]: - """Retrieve a list of variables. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Variable or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Variable] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("VariableListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_watcher_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_watcher_operations.py deleted file mode 100644 index e92b70568741..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_watcher_operations.py +++ /dev/null @@ -1,697 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._watcher_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_automation_account_request, - build_start_request, - build_stop_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class WatcherOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`watcher` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - watcher_name: str, - parameters: _models.Watcher, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Watcher: - """Create the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :param parameters: The create or update parameters for watcher. Required. - :type parameters: ~azure.mgmt.automation.models.Watcher - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - watcher_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Watcher: - """Create the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :param parameters: The create or update parameters for watcher. 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: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - watcher_name: str, - parameters: Union[_models.Watcher, IO[bytes]], - **kwargs: Any - ) -> _models.Watcher: - """Create the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :param parameters: The create or update parameters for watcher. Is either a Watcher type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.Watcher or IO[bytes] - :return: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Watcher") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - watcher_name=watcher_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("Watcher", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any - ) -> _models.Watcher: - """Retrieve the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :return: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - watcher_name=watcher_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("Watcher", 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, - watcher_name: str, - parameters: _models.WatcherUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Watcher: - """Update the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :param parameters: The update parameters for watcher. Required. - :type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - watcher_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Watcher: - """Update the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :param parameters: The update parameters for watcher. 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: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - automation_account_name: str, - watcher_name: str, - parameters: Union[_models.WatcherUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Watcher: - """Update the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :param parameters: The update parameters for watcher. Is either a WatcherUpdateParameters type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters or IO[bytes] - :return: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "WatcherUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - watcher_name=watcher_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("Watcher", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any - ) -> None: - """Delete the watcher by name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - watcher_name=watcher_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - 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. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - watcher_name=watcher_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - 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. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - watcher_name=watcher_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_by_automation_account( - self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Watcher"]: - """Retrieve a list of watchers. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 Watcher or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Watcher] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("WatcherListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_webhook_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_webhook_operations.py deleted file mode 100644 index 2f1b464b192e..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_webhook_operations.py +++ /dev/null @@ -1,633 +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 collections.abc import MutableMapping -from io import IOBase -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, - 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._webhook_operations import ( - build_create_or_update_request, - build_delete_request, - build_generate_uri_request, - build_get_request, - build_list_by_automation_account_request, - build_update_request, -) -from .._configuration import AutomationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class WebhookOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.aio.AutomationClient`'s - :attr:`webhook` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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: - """Generates a Uri for use in creating a webhook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: str or the result of cls(response) - :rtype: str - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - cls: ClsType[str] = kwargs.pop("cls", None) - - _request = build_generate_uri_request( - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, resource_group_name: str, automation_account_name: str, webhook_name: str, **kwargs: Any - ) -> None: - """Delete the webhook by name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - webhook_name=webhook_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, automation_account_name: str, webhook_name: str, **kwargs: Any - ) -> _models.Webhook: - """Retrieve the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :return: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - webhook_name=webhook_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("Webhook", 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, - webhook_name: str, - parameters: _models.WebhookCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Webhook: - """Create the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :param parameters: The create or update parameters for webhook. Required. - :type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - webhook_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Webhook: - """Create the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :param parameters: The create or update parameters for webhook. 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: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - webhook_name: str, - parameters: Union[_models.WebhookCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Webhook: - """Create the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :param parameters: The create or update parameters for webhook. Is either a - WebhookCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters or IO[bytes] - :return: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "WebhookCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - webhook_name=webhook_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("Webhook", 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, - webhook_name: str, - parameters: _models.WebhookUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Webhook: - """Update the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :param parameters: The update parameters for webhook. Required. - :type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - automation_account_name: str, - webhook_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Webhook: - """Update the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :param parameters: The update parameters for webhook. 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: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - automation_account_name: str, - webhook_name: str, - parameters: Union[_models.WebhookUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Webhook: - """Update the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :param parameters: The update parameters for webhook. Is either a WebhookUpdateParameters type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters or IO[bytes] - :return: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "WebhookUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - webhook_name=webhook_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("Webhook", 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, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Webhook"]: - """Retrieve a list of webhooks. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 Webhook or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("WebhookListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/models/__init__.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py index d8e72d9bc44e..17645d694b3d 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,13 +13,13 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore Activity, - ActivityListResult, ActivityOutputType, ActivityParameter, ActivityParameterSet, ActivityParameterValidationSet, + ActivityProperties, AdvancedSchedule, AdvancedScheduleMonthlyOccurrence, AgentRegistration, @@ -27,130 +27,195 @@ AgentRegistrationRegenerateKeyParameter, AutomationAccount, AutomationAccountCreateOrUpdateParameters, - AutomationAccountListResult, + AutomationAccountCreateOrUpdateProperties, + AutomationAccountProperties, AutomationAccountUpdateParameters, + AutomationAccountUpdateProperties, + AutomationErrorResponse, AzureQueryProperties, Certificate, CertificateCreateOrUpdateParameters, - CertificateListResult, + CertificateCreateOrUpdateProperties, + CertificateProperties, CertificateUpdateParameters, - CollectionItemUpdateConfiguration, + CertificateUpdateProperties, Connection, ConnectionCreateOrUpdateParameters, - ConnectionListResult, + ConnectionCreateOrUpdateProperties, + ConnectionProperties, ConnectionType, ConnectionTypeAssociationProperty, ConnectionTypeCreateOrUpdateParameters, - ConnectionTypeListResult, + ConnectionTypeCreateOrUpdateProperties, + ConnectionTypeProperties, ConnectionUpdateParameters, + ConnectionUpdateProperties, ContentHash, ContentLink, ContentSource, Credential, CredentialCreateOrUpdateParameters, - CredentialListResult, + CredentialCreateOrUpdateProperties, + CredentialProperties, CredentialUpdateParameters, - DscCompilationJob, - DscCompilationJobCreateParameters, - DscCompilationJobListResult, + CredentialUpdateProperties, + DeletedAutomationAccount, + DeletedAutomationAccountListResult, + DeletedAutomationAccountProperties, + DeletedRunbook, + DeletedRunbookProperties, + Dimension, DscConfiguration, DscConfigurationAssociationProperty, DscConfigurationCreateOrUpdateParameters, - DscConfigurationListResult, + DscConfigurationCreateOrUpdateProperties, DscConfigurationParameter, + DscConfigurationProperties, DscConfigurationUpdateParameters, DscMetaConfiguration, DscNode, DscNodeConfiguration, + DscNodeConfigurationAssociationProperty, DscNodeConfigurationCreateOrUpdateParameters, - DscNodeConfigurationListResult, + DscNodeConfigurationCreateOrUpdateParametersProperties, + DscNodeConfigurationProperties, DscNodeExtensionHandlerAssociationProperty, - DscNodeListResult, + DscNodeProperties, DscNodeReport, - DscNodeReportListResult, DscNodeUpdateParameters, DscNodeUpdateParametersProperties, DscReportError, DscReportResource, DscReportResourceNavigation, + EncryptionProperties, + EncryptionPropertiesIdentity, + ErrorAdditionalInfo, + ErrorDetail, ErrorResponse, FieldDefinition, + GraphicalRunbookContent, HybridRunbookWorker, + HybridRunbookWorkerCreateOrUpdateParameters, + HybridRunbookWorkerCreateParameters, HybridRunbookWorkerGroup, - HybridRunbookWorkerGroupUpdateParameters, - HybridRunbookWorkerGroupsListResult, + HybridRunbookWorkerGroupCreateOrUpdateParameters, + HybridRunbookWorkerGroupCreateOrUpdateProperties, + HybridRunbookWorkerGroupProperties, + HybridRunbookWorkerMoveParameters, + HybridRunbookWorkerProperties, + Identity, Job, JobCollectionItem, + JobCollectionItemProperties, JobCreateParameters, - JobListResultV2, + JobCreateProperties, JobNavigation, + JobProperties, + JobRuntimeEnvironment, JobSchedule, JobScheduleCreateParameters, - JobScheduleListResult, + JobScheduleCreateProperties, + JobScheduleProperties, JobStream, - JobStreamListResult, + JobStreamProperties, Key, KeyListResult, + KeyVaultProperties, LinkedWorkspace, LinuxProperties, + LogSpecification, + MetricSpecification, Module, ModuleCreateOrUpdateParameters, + ModuleCreateOrUpdateProperties, ModuleErrorInfo, - ModuleListResult, + ModuleProperties, ModuleUpdateParameters, + ModuleUpdateProperties, NodeCount, NodeCountProperties, NodeCounts, NonAzureQueryProperties, Operation, OperationDisplay, - OperationListResult, + OperationPropertiesFormat, + OperationPropertiesFormatServiceSpecification, + Package, + PackageCreateOrUpdateParameters, + PackageCreateOrUpdateProperties, + PackageErrorInfo, + PackageProperties, + PackageUpdateParameters, + PackageUpdateProperties, + PrivateEndpointConnection, + PrivateEndpointConnectionProperties, + PrivateEndpointProperty, + PrivateLinkResource, + PrivateLinkResourceProperties, + PrivateLinkServiceConnectionStateProperty, ProxyResource, PythonPackageCreateParameters, + PythonPackageCreateProperties, PythonPackageUpdateParameters, + RawGraphicalRunbookContent, Resource, RunAsCredentialAssociationProperty, Runbook, RunbookAssociationProperty, - RunbookCreateOrUpdateDraftParameters, - RunbookCreateOrUpdateDraftProperties, RunbookCreateOrUpdateParameters, + RunbookCreateOrUpdateProperties, RunbookDraft, RunbookDraftUndoEditResult, - RunbookListResult, RunbookParameter, + RunbookProperties, RunbookUpdateParameters, + RunbookUpdateProperties, + RuntimeEnvironment, + RuntimeEnvironmentProperties, + RuntimeEnvironmentUpdateParameters, + RuntimeEnvironmentUpdateProperties, + RuntimeProperties, + SUCScheduleProperties, Schedule, ScheduleAssociationProperty, ScheduleCreateOrUpdateParameters, - ScheduleListResult, + ScheduleCreateOrUpdateProperties, ScheduleProperties, ScheduleUpdateParameters, + ScheduleUpdateProperties, Sku, - SoftareUpdateConfigurationRunTaskProperties, - SoftareUpdateConfigurationRunTasks, SoftwareUpdateConfiguration, SoftwareUpdateConfigurationCollectionItem, + SoftwareUpdateConfigurationCollectionItemProperties, SoftwareUpdateConfigurationListResult, SoftwareUpdateConfigurationMachineRun, SoftwareUpdateConfigurationMachineRunListResult, + SoftwareUpdateConfigurationProperties, SoftwareUpdateConfigurationRun, SoftwareUpdateConfigurationRunListResult, + SoftwareUpdateConfigurationRunProperties, + SoftwareUpdateConfigurationRunTaskProperties, + SoftwareUpdateConfigurationRunTasks, SoftwareUpdateConfigurationTasks, SourceControl, SourceControlCreateOrUpdateParameters, - SourceControlListResult, + SourceControlCreateOrUpdateProperties, + SourceControlProperties, SourceControlSecurityTokenProperties, SourceControlSyncJob, SourceControlSyncJobById, + SourceControlSyncJobByIdProperties, SourceControlSyncJobCreateParameters, - SourceControlSyncJobListResult, + SourceControlSyncJobCreateProperties, + SourceControlSyncJobProperties, SourceControlSyncJobStream, SourceControlSyncJobStreamById, - SourceControlSyncJobStreamsListBySyncJob, + SourceControlSyncJobStreamByIdProperties, + SourceControlSyncJobStreamProperties, SourceControlUpdateParameters, + SourceControlUpdateProperties, Statistics, - StatisticsListResult, + SystemData, TagSettingsProperties, TargetProperties, TaskProperties, @@ -158,34 +223,42 @@ TestJobCreateParameters, TrackedResource, TypeField, - TypeFieldListResult, UpdateConfiguration, + UpdateConfigurationMachineRunProperties, UpdateConfigurationNavigation, Usage, UsageCounterName, - UsageListResult, + UserAssignedIdentitiesProperties, Variable, VariableCreateOrUpdateParameters, - VariableListResult, + VariableCreateOrUpdateProperties, + VariableProperties, VariableUpdateParameters, + VariableUpdateProperties, Watcher, - WatcherListResult, + WatcherProperties, WatcherUpdateParameters, + WatcherUpdateProperties, Webhook, WebhookCreateOrUpdateParameters, - WebhookListResult, + WebhookCreateOrUpdateProperties, + WebhookProperties, WebhookUpdateParameters, + WebhookUpdateProperties, WindowsProperties, ) -from ._automation_client_enums import ( # type: ignore +from ._enums import ( # type: ignore AgentRegistrationKeyName, AutomationAccountState, AutomationKeyName, AutomationKeyPermissions, ContentSourceType, CountType, + CreatedByType, DscConfigurationState, + EncryptionKeySourceType, + GraphRunbookType, GroupTypeEnum, HttpStatusCode, JobProvisioningState, @@ -194,7 +267,9 @@ LinuxUpdateClasses, ModuleProvisioningState, OperatingSystemType, + PackageProvisioningState, ProvisioningState, + ResourceIdentityType, RunbookState, RunbookTypeEnum, ScheduleDay, @@ -206,6 +281,7 @@ TagOperators, TokenType, WindowsUpdateClasses, + WorkerType, ) from ._patch import __all__ as _patch_all from ._patch import * @@ -213,11 +289,11 @@ __all__ = [ "Activity", - "ActivityListResult", "ActivityOutputType", "ActivityParameter", "ActivityParameterSet", "ActivityParameterValidationSet", + "ActivityProperties", "AdvancedSchedule", "AdvancedScheduleMonthlyOccurrence", "AgentRegistration", @@ -225,130 +301,195 @@ "AgentRegistrationRegenerateKeyParameter", "AutomationAccount", "AutomationAccountCreateOrUpdateParameters", - "AutomationAccountListResult", + "AutomationAccountCreateOrUpdateProperties", + "AutomationAccountProperties", "AutomationAccountUpdateParameters", + "AutomationAccountUpdateProperties", + "AutomationErrorResponse", "AzureQueryProperties", "Certificate", "CertificateCreateOrUpdateParameters", - "CertificateListResult", + "CertificateCreateOrUpdateProperties", + "CertificateProperties", "CertificateUpdateParameters", - "CollectionItemUpdateConfiguration", + "CertificateUpdateProperties", "Connection", "ConnectionCreateOrUpdateParameters", - "ConnectionListResult", + "ConnectionCreateOrUpdateProperties", + "ConnectionProperties", "ConnectionType", "ConnectionTypeAssociationProperty", "ConnectionTypeCreateOrUpdateParameters", - "ConnectionTypeListResult", + "ConnectionTypeCreateOrUpdateProperties", + "ConnectionTypeProperties", "ConnectionUpdateParameters", + "ConnectionUpdateProperties", "ContentHash", "ContentLink", "ContentSource", "Credential", "CredentialCreateOrUpdateParameters", - "CredentialListResult", + "CredentialCreateOrUpdateProperties", + "CredentialProperties", "CredentialUpdateParameters", - "DscCompilationJob", - "DscCompilationJobCreateParameters", - "DscCompilationJobListResult", + "CredentialUpdateProperties", + "DeletedAutomationAccount", + "DeletedAutomationAccountListResult", + "DeletedAutomationAccountProperties", + "DeletedRunbook", + "DeletedRunbookProperties", + "Dimension", "DscConfiguration", "DscConfigurationAssociationProperty", "DscConfigurationCreateOrUpdateParameters", - "DscConfigurationListResult", + "DscConfigurationCreateOrUpdateProperties", "DscConfigurationParameter", + "DscConfigurationProperties", "DscConfigurationUpdateParameters", "DscMetaConfiguration", "DscNode", "DscNodeConfiguration", + "DscNodeConfigurationAssociationProperty", "DscNodeConfigurationCreateOrUpdateParameters", - "DscNodeConfigurationListResult", + "DscNodeConfigurationCreateOrUpdateParametersProperties", + "DscNodeConfigurationProperties", "DscNodeExtensionHandlerAssociationProperty", - "DscNodeListResult", + "DscNodeProperties", "DscNodeReport", - "DscNodeReportListResult", "DscNodeUpdateParameters", "DscNodeUpdateParametersProperties", "DscReportError", "DscReportResource", "DscReportResourceNavigation", + "EncryptionProperties", + "EncryptionPropertiesIdentity", + "ErrorAdditionalInfo", + "ErrorDetail", "ErrorResponse", "FieldDefinition", + "GraphicalRunbookContent", "HybridRunbookWorker", + "HybridRunbookWorkerCreateOrUpdateParameters", + "HybridRunbookWorkerCreateParameters", "HybridRunbookWorkerGroup", - "HybridRunbookWorkerGroupUpdateParameters", - "HybridRunbookWorkerGroupsListResult", + "HybridRunbookWorkerGroupCreateOrUpdateParameters", + "HybridRunbookWorkerGroupCreateOrUpdateProperties", + "HybridRunbookWorkerGroupProperties", + "HybridRunbookWorkerMoveParameters", + "HybridRunbookWorkerProperties", + "Identity", "Job", "JobCollectionItem", + "JobCollectionItemProperties", "JobCreateParameters", - "JobListResultV2", + "JobCreateProperties", "JobNavigation", + "JobProperties", + "JobRuntimeEnvironment", "JobSchedule", "JobScheduleCreateParameters", - "JobScheduleListResult", + "JobScheduleCreateProperties", + "JobScheduleProperties", "JobStream", - "JobStreamListResult", + "JobStreamProperties", "Key", "KeyListResult", + "KeyVaultProperties", "LinkedWorkspace", "LinuxProperties", + "LogSpecification", + "MetricSpecification", "Module", "ModuleCreateOrUpdateParameters", + "ModuleCreateOrUpdateProperties", "ModuleErrorInfo", - "ModuleListResult", + "ModuleProperties", "ModuleUpdateParameters", + "ModuleUpdateProperties", "NodeCount", "NodeCountProperties", "NodeCounts", "NonAzureQueryProperties", "Operation", "OperationDisplay", - "OperationListResult", + "OperationPropertiesFormat", + "OperationPropertiesFormatServiceSpecification", + "Package", + "PackageCreateOrUpdateParameters", + "PackageCreateOrUpdateProperties", + "PackageErrorInfo", + "PackageProperties", + "PackageUpdateParameters", + "PackageUpdateProperties", + "PrivateEndpointConnection", + "PrivateEndpointConnectionProperties", + "PrivateEndpointProperty", + "PrivateLinkResource", + "PrivateLinkResourceProperties", + "PrivateLinkServiceConnectionStateProperty", "ProxyResource", "PythonPackageCreateParameters", + "PythonPackageCreateProperties", "PythonPackageUpdateParameters", + "RawGraphicalRunbookContent", "Resource", "RunAsCredentialAssociationProperty", "Runbook", "RunbookAssociationProperty", - "RunbookCreateOrUpdateDraftParameters", - "RunbookCreateOrUpdateDraftProperties", "RunbookCreateOrUpdateParameters", + "RunbookCreateOrUpdateProperties", "RunbookDraft", "RunbookDraftUndoEditResult", - "RunbookListResult", "RunbookParameter", + "RunbookProperties", "RunbookUpdateParameters", + "RunbookUpdateProperties", + "RuntimeEnvironment", + "RuntimeEnvironmentProperties", + "RuntimeEnvironmentUpdateParameters", + "RuntimeEnvironmentUpdateProperties", + "RuntimeProperties", + "SUCScheduleProperties", "Schedule", "ScheduleAssociationProperty", "ScheduleCreateOrUpdateParameters", - "ScheduleListResult", + "ScheduleCreateOrUpdateProperties", "ScheduleProperties", "ScheduleUpdateParameters", + "ScheduleUpdateProperties", "Sku", - "SoftareUpdateConfigurationRunTaskProperties", - "SoftareUpdateConfigurationRunTasks", "SoftwareUpdateConfiguration", "SoftwareUpdateConfigurationCollectionItem", + "SoftwareUpdateConfigurationCollectionItemProperties", "SoftwareUpdateConfigurationListResult", "SoftwareUpdateConfigurationMachineRun", "SoftwareUpdateConfigurationMachineRunListResult", + "SoftwareUpdateConfigurationProperties", "SoftwareUpdateConfigurationRun", "SoftwareUpdateConfigurationRunListResult", + "SoftwareUpdateConfigurationRunProperties", + "SoftwareUpdateConfigurationRunTaskProperties", + "SoftwareUpdateConfigurationRunTasks", "SoftwareUpdateConfigurationTasks", "SourceControl", "SourceControlCreateOrUpdateParameters", - "SourceControlListResult", + "SourceControlCreateOrUpdateProperties", + "SourceControlProperties", "SourceControlSecurityTokenProperties", "SourceControlSyncJob", "SourceControlSyncJobById", + "SourceControlSyncJobByIdProperties", "SourceControlSyncJobCreateParameters", - "SourceControlSyncJobListResult", + "SourceControlSyncJobCreateProperties", + "SourceControlSyncJobProperties", "SourceControlSyncJobStream", "SourceControlSyncJobStreamById", - "SourceControlSyncJobStreamsListBySyncJob", + "SourceControlSyncJobStreamByIdProperties", + "SourceControlSyncJobStreamProperties", "SourceControlUpdateParameters", + "SourceControlUpdateProperties", "Statistics", - "StatisticsListResult", + "SystemData", "TagSettingsProperties", "TargetProperties", "TaskProperties", @@ -356,23 +497,28 @@ "TestJobCreateParameters", "TrackedResource", "TypeField", - "TypeFieldListResult", "UpdateConfiguration", + "UpdateConfigurationMachineRunProperties", "UpdateConfigurationNavigation", "Usage", "UsageCounterName", - "UsageListResult", + "UserAssignedIdentitiesProperties", "Variable", "VariableCreateOrUpdateParameters", - "VariableListResult", + "VariableCreateOrUpdateProperties", + "VariableProperties", "VariableUpdateParameters", + "VariableUpdateProperties", "Watcher", - "WatcherListResult", + "WatcherProperties", "WatcherUpdateParameters", + "WatcherUpdateProperties", "Webhook", "WebhookCreateOrUpdateParameters", - "WebhookListResult", + "WebhookCreateOrUpdateProperties", + "WebhookProperties", "WebhookUpdateParameters", + "WebhookUpdateProperties", "WindowsProperties", "AgentRegistrationKeyName", "AutomationAccountState", @@ -380,7 +526,10 @@ "AutomationKeyPermissions", "ContentSourceType", "CountType", + "CreatedByType", "DscConfigurationState", + "EncryptionKeySourceType", + "GraphRunbookType", "GroupTypeEnum", "HttpStatusCode", "JobProvisioningState", @@ -389,7 +538,9 @@ "LinuxUpdateClasses", "ModuleProvisioningState", "OperatingSystemType", + "PackageProvisioningState", "ProvisioningState", + "ResourceIdentityType", "RunbookState", "RunbookTypeEnum", "ScheduleDay", @@ -401,6 +552,7 @@ "TagOperators", "TokenType", "WindowsUpdateClasses", + "WorkerType", ] __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/_enums.py similarity index 57% rename from sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_automation_client_enums.py rename to sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_enums.py index 2fd1e976b039..84592234cdc6 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/_enums.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -14,215 +14,425 @@ class AgentRegistrationKeyName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the agent registration key name - primary or secondary.""" PRIMARY = "primary" + """primary.""" SECONDARY = "secondary" + """secondary.""" class AutomationAccountState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets status of account.""" OK = "Ok" + """Ok.""" UNAVAILABLE = "Unavailable" + """Unavailable.""" SUSPENDED = "Suspended" + """Suspended.""" class AutomationKeyName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Automation key name.""" PRIMARY = "Primary" + """Primary.""" SECONDARY = "Secondary" + """Secondary.""" class AutomationKeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Automation key permissions.""" READ = "Read" + """Read.""" FULL = "Full" + """Full.""" class ContentSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the content source type.""" EMBEDDED_CONTENT = "embeddedContent" + """embeddedContent.""" URI = "uri" + """uri.""" class CountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """CountType.""" + """Type of CountType.""" STATUS = "status" + """status.""" NODECONFIGURATION = "nodeconfiguration" + """nodeconfiguration.""" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of entity that created the resource.""" + + USER = "User" + """The entity was created by a user.""" + APPLICATION = "Application" + """The entity was created by an application.""" + MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" + KEY = "Key" + """The entity was created by a key.""" class DscConfigurationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the state of the configuration.""" NEW = "New" + """New.""" EDIT = "Edit" + """Edit.""" PUBLISHED = "Published" + """Published.""" + + +class EncryptionKeySourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Encryption Key Source.""" + + MICROSOFT_AUTOMATION = "Microsoft.Automation" + """Microsoft.Automation.""" + MICROSOFT_KEYVAULT = "Microsoft.Keyvault" + """Microsoft.Keyvault.""" + + +class GraphRunbookType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Runbook Type.""" + + GRAPH_POWER_SHELL = "GraphPowerShell" + """GraphPowerShell.""" + GRAPH_POWER_SHELL_WORKFLOW = "GraphPowerShellWorkflow" + """GraphPowerShellWorkflow.""" class GroupTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the HybridWorkerGroup.""" USER = "User" + """User.""" SYSTEM = "System" + """System.""" class HttpStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """HttpStatusCode.""" + """Type of HttpStatusCode.""" CONTINUE = "Continue" + """Continue.""" SWITCHING_PROTOCOLS = "SwitchingProtocols" + """SwitchingProtocols.""" OK = "OK" + """OK.""" CREATED = "Created" + """Created.""" ACCEPTED = "Accepted" + """Accepted.""" NON_AUTHORITATIVE_INFORMATION = "NonAuthoritativeInformation" + """NonAuthoritativeInformation.""" NO_CONTENT = "NoContent" + """NoContent.""" RESET_CONTENT = "ResetContent" + """ResetContent.""" PARTIAL_CONTENT = "PartialContent" + """PartialContent.""" MULTIPLE_CHOICES = "MultipleChoices" + """MultipleChoices.""" AMBIGUOUS = "Ambiguous" + """Ambiguous.""" MOVED_PERMANENTLY = "MovedPermanently" + """MovedPermanently.""" MOVED = "Moved" + """Moved.""" FOUND = "Found" + """Found.""" REDIRECT = "Redirect" + """Redirect.""" SEE_OTHER = "SeeOther" + """SeeOther.""" REDIRECT_METHOD = "RedirectMethod" + """RedirectMethod.""" NOT_MODIFIED = "NotModified" + """NotModified.""" USE_PROXY = "UseProxy" + """UseProxy.""" UNUSED = "Unused" + """Unused.""" TEMPORARY_REDIRECT = "TemporaryRedirect" + """TemporaryRedirect.""" REDIRECT_KEEP_VERB = "RedirectKeepVerb" + """RedirectKeepVerb.""" BAD_REQUEST = "BadRequest" + """BadRequest.""" UNAUTHORIZED = "Unauthorized" + """Unauthorized.""" PAYMENT_REQUIRED = "PaymentRequired" + """PaymentRequired.""" FORBIDDEN = "Forbidden" + """Forbidden.""" NOT_FOUND = "NotFound" + """NotFound.""" METHOD_NOT_ALLOWED = "MethodNotAllowed" + """MethodNotAllowed.""" NOT_ACCEPTABLE = "NotAcceptable" + """NotAcceptable.""" PROXY_AUTHENTICATION_REQUIRED = "ProxyAuthenticationRequired" + """ProxyAuthenticationRequired.""" REQUEST_TIMEOUT = "RequestTimeout" + """RequestTimeout.""" CONFLICT = "Conflict" + """Conflict.""" GONE = "Gone" + """Gone.""" LENGTH_REQUIRED = "LengthRequired" + """LengthRequired.""" PRECONDITION_FAILED = "PreconditionFailed" + """PreconditionFailed.""" REQUEST_ENTITY_TOO_LARGE = "RequestEntityTooLarge" + """RequestEntityTooLarge.""" REQUEST_URI_TOO_LONG = "RequestUriTooLong" + """RequestUriTooLong.""" UNSUPPORTED_MEDIA_TYPE = "UnsupportedMediaType" + """UnsupportedMediaType.""" REQUESTED_RANGE_NOT_SATISFIABLE = "RequestedRangeNotSatisfiable" + """RequestedRangeNotSatisfiable.""" EXPECTATION_FAILED = "ExpectationFailed" + """ExpectationFailed.""" UPGRADE_REQUIRED = "UpgradeRequired" + """UpgradeRequired.""" INTERNAL_SERVER_ERROR = "InternalServerError" + """InternalServerError.""" NOT_IMPLEMENTED = "NotImplemented" + """NotImplemented.""" BAD_GATEWAY = "BadGateway" + """BadGateway.""" SERVICE_UNAVAILABLE = "ServiceUnavailable" + """ServiceUnavailable.""" GATEWAY_TIMEOUT = "GatewayTimeout" + """GatewayTimeout.""" HTTP_VERSION_NOT_SUPPORTED = "HttpVersionNotSupported" + """HttpVersionNotSupported.""" class JobProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the resource.""" FAILED = "Failed" + """Failed.""" SUCCEEDED = "Succeeded" + """Succeeded.""" SUSPENDED = "Suspended" + """Suspended.""" PROCESSING = "Processing" + """Processing.""" class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the status of the job.""" NEW = "New" + """New.""" ACTIVATING = "Activating" + """Activating.""" RUNNING = "Running" + """Running.""" COMPLETED = "Completed" + """Completed.""" FAILED = "Failed" + """Failed.""" STOPPED = "Stopped" + """Stopped.""" BLOCKED = "Blocked" + """Blocked.""" SUSPENDED = "Suspended" + """Suspended.""" DISCONNECTED = "Disconnected" + """Disconnected.""" SUSPENDING = "Suspending" + """Suspending.""" STOPPING = "Stopping" + """Stopping.""" RESUMING = "Resuming" + """Resuming.""" REMOVING = "Removing" + """Removing.""" class JobStreamType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the stream type.""" PROGRESS = "Progress" + """Progress.""" OUTPUT = "Output" + """Output.""" WARNING = "Warning" + """Warning.""" ERROR = "Error" + """Error.""" DEBUG = "Debug" + """Debug.""" VERBOSE = "Verbose" + """Verbose.""" ANY = "Any" + """Any.""" class LinuxUpdateClasses(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Update classifications included in the software update configuration.""" UNCLASSIFIED = "Unclassified" + """Unclassified.""" CRITICAL = "Critical" + """Critical.""" SECURITY = "Security" + """Security.""" OTHER = "Other" + """Other.""" class ModuleProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the provisioning state of the module.""" CREATED = "Created" + """Created.""" CREATING = "Creating" + """Creating.""" STARTING_IMPORT_MODULE_RUNBOOK = "StartingImportModuleRunbook" + """StartingImportModuleRunbook.""" RUNNING_IMPORT_MODULE_RUNBOOK = "RunningImportModuleRunbook" + """RunningImportModuleRunbook.""" CONTENT_RETRIEVED = "ContentRetrieved" + """ContentRetrieved.""" CONTENT_DOWNLOADED = "ContentDownloaded" + """ContentDownloaded.""" CONTENT_VALIDATED = "ContentValidated" + """ContentValidated.""" CONNECTION_TYPE_IMPORTED = "ConnectionTypeImported" + """ConnectionTypeImported.""" CONTENT_STORED = "ContentStored" + """ContentStored.""" MODULE_DATA_STORED = "ModuleDataStored" + """ModuleDataStored.""" ACTIVITIES_STORED = "ActivitiesStored" + """ActivitiesStored.""" MODULE_IMPORT_RUNBOOK_COMPLETE = "ModuleImportRunbookComplete" + """ModuleImportRunbookComplete.""" SUCCEEDED = "Succeeded" + """Succeeded.""" FAILED = "Failed" - CANCELLED = "Cancelled" + """Failed.""" + CANCELED = "Canceled" + """Canceled.""" UPDATING = "Updating" + """Updating.""" class OperatingSystemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Target operating system for the software update configuration.""" WINDOWS = "Windows" + """Windows.""" LINUX = "Linux" + """Linux.""" + + +class PackageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the provisioning state of the Package.""" + + CREATED = "Created" + """Created.""" + CREATING = "Creating" + """Creating.""" + STARTING_IMPORT_MODULE_RUNBOOK = "StartingImportModuleRunbook" + """StartingImportModuleRunbook.""" + RUNNING_IMPORT_MODULE_RUNBOOK = "RunningImportModuleRunbook" + """RunningImportModuleRunbook.""" + CONTENT_RETRIEVED = "ContentRetrieved" + """ContentRetrieved.""" + CONTENT_DOWNLOADED = "ContentDownloaded" + """ContentDownloaded.""" + CONTENT_VALIDATED = "ContentValidated" + """ContentValidated.""" + CONNECTION_TYPE_IMPORTED = "ConnectionTypeImported" + """ConnectionTypeImported.""" + CONTENT_STORED = "ContentStored" + """ContentStored.""" + MODULE_DATA_STORED = "ModuleDataStored" + """ModuleDataStored.""" + ACTIVITIES_STORED = "ActivitiesStored" + """ActivitiesStored.""" + MODULE_IMPORT_RUNBOOK_COMPLETE = "ModuleImportRunbookComplete" + """ModuleImportRunbookComplete.""" + SUCCEEDED = "Succeeded" + """Succeeded.""" + FAILED = "Failed" + """Failed.""" + CANCELED = "Canceled" + """Canceled.""" + UPDATING = "Updating" + """Updating.""" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the job.""" COMPLETED = "Completed" + """Completed.""" FAILED = "Failed" + """Failed.""" RUNNING = "Running" + """Running.""" + + +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The identity type.""" + + SYSTEM_ASSIGNED = "SystemAssigned" + """SystemAssigned.""" + USER_ASSIGNED = "UserAssigned" + """UserAssigned.""" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + """SystemAssigned, UserAssigned.""" + NONE = "None" + """None.""" class RunbookState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the state of the runbook.""" NEW = "New" + """New.""" EDIT = "Edit" + """Edit.""" PUBLISHED = "Published" + """Published.""" class RunbookTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the type of the runbook.""" SCRIPT = "Script" + """Script.""" GRAPH = "Graph" + """Graph.""" POWER_SHELL_WORKFLOW = "PowerShellWorkflow" + """PowerShellWorkflow.""" POWER_SHELL = "PowerShell" + """PowerShell.""" GRAPH_POWER_SHELL_WORKFLOW = "GraphPowerShellWorkflow" + """GraphPowerShellWorkflow.""" GRAPH_POWER_SHELL = "GraphPowerShell" + """GraphPowerShell.""" PYTHON2 = "Python2" + """Python2.""" PYTHON3 = "Python3" + """Python3.""" + PYTHON = "Python" + """Python.""" + POWER_SHELL72 = "PowerShell72" + """PowerShell72.""" class ScheduleDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -231,22 +441,34 @@ class ScheduleDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ MONDAY = "Monday" + """Monday.""" TUESDAY = "Tuesday" + """Tuesday.""" WEDNESDAY = "Wednesday" + """Wednesday.""" THURSDAY = "Thursday" + """Thursday.""" FRIDAY = "Friday" + """Friday.""" SATURDAY = "Saturday" + """Saturday.""" SUNDAY = "Sunday" + """Sunday.""" class ScheduleFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the frequency of the schedule.""" ONE_TIME = "OneTime" + """OneTime.""" DAY = "Day" + """Day.""" HOUR = "Hour" + """Hour.""" WEEK = "Week" + """Week.""" MONTH = "Month" + """Month.""" MINUTE = "Minute" """The minimum allowed interval for Minute schedules is 15 minutes.""" @@ -255,43 +477,56 @@ class SkuNameEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the SKU name of the account.""" FREE = "Free" + """Free.""" BASIC = "Basic" + """Basic.""" class SourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The source type. Must be one of VsoGit, VsoTfvc, GitHub.""" VSO_GIT = "VsoGit" + """VsoGit.""" VSO_TFVC = "VsoTfvc" + """VsoTfvc.""" GIT_HUB = "GitHub" + """GitHub.""" class StreamType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the sync job stream.""" ERROR = "Error" + """Error.""" OUTPUT = "Output" + """Output.""" class SyncType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The sync type.""" PARTIAL_SYNC = "PartialSync" + """PartialSync.""" FULL_SYNC = "FullSync" + """FullSync.""" class TagOperators(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Filter VMs by Any or All specified tags.""" ALL = "All" + """All.""" ANY = "Any" + """Any.""" class TokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The token type. Must be either PersonalAccessToken or Oauth.""" PERSONAL_ACCESS_TOKEN = "PersonalAccessToken" + """PersonalAccessToken.""" OAUTH = "Oauth" + """Oauth.""" class WindowsUpdateClasses(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -300,11 +535,29 @@ class WindowsUpdateClasses(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ UNCLASSIFIED = "Unclassified" + """Unclassified.""" CRITICAL = "Critical" + """Critical.""" SECURITY = "Security" + """Security.""" UPDATE_ROLLUP = "UpdateRollup" + """UpdateRollup.""" FEATURE_PACK = "FeaturePack" + """FeaturePack.""" SERVICE_PACK = "ServicePack" + """ServicePack.""" DEFINITION = "Definition" + """Definition.""" TOOLS = "Tools" + """Tools.""" UPDATES = "Updates" + """Updates.""" + + +class WorkerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the HybridWorker.""" + + HYBRID_V1 = "HybridV1" + """HybridV1.""" + HYBRID_V2 = "HybridV2" + """HybridV2.""" diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models.py new file mode 100644 index 000000000000..2eb2bd3e5120 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models.py @@ -0,0 +1,12200 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class Activity(_Model): + """Definition of the activity. + + :ivar id: Gets or sets the id of the resource. + :vartype id: str + :ivar name: Gets the name of the activity. + :vartype name: str + :ivar properties: Gets or sets the properties of the activity. + :vartype properties: ~azure.mgmt.automation.models.ActivityProperties + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the id of the resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Gets the name of the activity.""" + properties: Optional["_models.ActivityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the activity.""" + + __flattened_items = [ + "definition", + "parameter_sets", + "output_types", + "creation_time", + "last_modified_time", + "description", + ] + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + properties: Optional["_models.ActivityProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ActivityOutputType(_Model): + """Definition of the activity output type. + + :ivar name: Gets or sets the name of the activity output type. + :vartype name: str + :ivar type: Gets or sets the type of the activity output type. + :vartype type: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the activity output type.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the type of the activity output type.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ActivityParameter(_Model): + """Definition of the activity parameter. + + :ivar name: Gets or sets the name of the activity parameter. + :vartype name: str + :ivar type: Gets or sets the type of the activity parameter. + :vartype type: str + :ivar is_mandatory: Gets or sets a Boolean value that indicates true if the parameter is + required. If the value is false, the parameter is optional. + :vartype is_mandatory: bool + :ivar is_dynamic: Gets or sets a Boolean value that indicates true if the parameter is dynamic. + :vartype is_dynamic: bool + :ivar position: Gets or sets the position of the activity parameter. + :vartype position: int + :ivar value_from_pipeline: Gets or sets a Boolean value that indicates true if the parameter + can take values from the incoming pipeline objects. This setting is used if the cmdlet must + access the complete input object. false indicates that the parameter cannot take values from + the complete input object. + :vartype value_from_pipeline: bool + :ivar value_from_pipeline_by_property_name: Gets or sets a Boolean value that indicates true if + the parameter can be filled from a property of the incoming pipeline object that has the same + name as this parameter. false indicates that the parameter cannot be filled from the incoming + pipeline object property with the same name. + :vartype value_from_pipeline_by_property_name: bool + :ivar value_from_remaining_arguments: Gets or sets a Boolean value that indicates true if the + cmdlet parameter accepts all the remaining command-line arguments that are associated with this + parameter in the form of an array. false if the cmdlet parameter does not accept all the + remaining argument values. + :vartype value_from_remaining_arguments: bool + :ivar description: Gets or sets the description of the activity parameter. + :vartype description: str + :ivar validation_set: Gets or sets the validation set of activity parameter. + :vartype validation_set: list[~azure.mgmt.automation.models.ActivityParameterValidationSet] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the activity parameter.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the type of the activity parameter.""" + is_mandatory: Optional[bool] = rest_field( + name="isMandatory", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a Boolean value that indicates true if the parameter is required. If the value is + false, the parameter is optional.""" + is_dynamic: Optional[bool] = rest_field( + name="isDynamic", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a Boolean value that indicates true if the parameter is dynamic.""" + position: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the position of the activity parameter.""" + value_from_pipeline: Optional[bool] = rest_field( + name="valueFromPipeline", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a Boolean value that indicates true if the parameter can take values from the + incoming pipeline objects. This setting is used if the cmdlet must access the complete input + object. false indicates that the parameter cannot take values from the complete input object.""" + value_from_pipeline_by_property_name: Optional[bool] = rest_field( + name="valueFromPipelineByPropertyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a Boolean value that indicates true if the parameter can be filled from a property + of the incoming pipeline object that has the same name as this parameter. false indicates that + the parameter cannot be filled from the incoming pipeline object property with the same name.""" + value_from_remaining_arguments: Optional[bool] = rest_field( + name="valueFromRemainingArguments", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a Boolean value that indicates true if the cmdlet parameter accepts all the + remaining command-line arguments that are associated with this parameter in the form of an + array. false if the cmdlet parameter does not accept all the remaining argument values.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the activity parameter.""" + validation_set: Optional[list["_models.ActivityParameterValidationSet"]] = rest_field( + name="validationSet", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the validation set of activity parameter.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + is_mandatory: Optional[bool] = None, + is_dynamic: Optional[bool] = None, + position: Optional[int] = None, + value_from_pipeline: Optional[bool] = None, + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ActivityParameterSet(_Model): + """Definition of the activity parameter set. + + :ivar name: Gets or sets the name of the activity parameter set. + :vartype name: str + :ivar parameters: Gets or sets the parameters of the activity parameter set. + :vartype parameters: list[~azure.mgmt.automation.models.ActivityParameter] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the activity parameter set.""" + parameters: Optional[list["_models.ActivityParameter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the parameters of the activity parameter set.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + parameters: Optional[list["_models.ActivityParameter"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ActivityParameterValidationSet(_Model): + """Definition of the activity parameter validation set. + + :ivar member_value: Gets or sets the name of the activity parameter validation set member. + :vartype member_value: str + """ + + member_value: Optional[str] = rest_field( + name="memberValue", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the name of the activity parameter validation set member.""" + + @overload + def __init__( + self, + *, + member_value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ActivityProperties(_Model): + """Properties of the activity. + + :ivar definition: Gets or sets the user name of the activity. + :vartype definition: str + :ivar parameter_sets: Gets or sets the parameter sets of the activity. + :vartype parameter_sets: list[~azure.mgmt.automation.models.ActivityParameterSet] + :ivar output_types: Gets or sets the output types of the activity. + :vartype output_types: list[~azure.mgmt.automation.models.ActivityOutputType] + :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 + """ + + definition: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the user name of the activity.""" + parameter_sets: Optional[list["_models.ActivityParameterSet"]] = rest_field( + name="parameterSets", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the parameter sets of the activity.""" + output_types: Optional[list["_models.ActivityOutputType"]] = rest_field( + name="outputTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the output types of the activity.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + + @overload + def __init__( + self, + *, + definition: Optional[str] = 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AdvancedSchedule(_Model): + """The properties of the create Advanced Schedule. + + :ivar week_days: Days of the week that the job should execute on. + :vartype week_days: list[str] + :ivar month_days: Days of the month that the job should execute on. Must be between 1 and 31. + :vartype month_days: list[int] + :ivar monthly_occurrences: Occurrences of days within a month. + :vartype monthly_occurrences: + list[~azure.mgmt.automation.models.AdvancedScheduleMonthlyOccurrence] + """ + + week_days: Optional[list[str]] = rest_field( + name="weekDays", visibility=["read", "create", "update", "delete", "query"] + ) + """Days of the week that the job should execute on.""" + month_days: Optional[list[int]] = rest_field( + name="monthDays", visibility=["read", "create", "update", "delete", "query"] + ) + """Days of the month that the job should execute on. Must be between 1 and 31.""" + monthly_occurrences: Optional[list["_models.AdvancedScheduleMonthlyOccurrence"]] = rest_field( + name="monthlyOccurrences", visibility=["read", "create", "update", "delete", "query"] + ) + """Occurrences of days within a month.""" + + @overload + def __init__( + self, + *, + week_days: Optional[list[str]] = None, + month_days: Optional[list[int]] = None, + monthly_occurrences: Optional[list["_models.AdvancedScheduleMonthlyOccurrence"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AdvancedScheduleMonthlyOccurrence(_Model): + """The properties of the create advanced schedule monthly occurrence. + + :ivar occurrence: Occurrence of the week within the month. Must be between 1 and 5. + :vartype occurrence: int + :ivar day: Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday, + saturday, sunday. Known values are: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", + "Saturday", and "Sunday". + :vartype day: str or ~azure.mgmt.automation.models.ScheduleDay + """ + + occurrence: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Occurrence of the week within the month. Must be between 1 and 5.""" + day: Optional[Union[str, "_models.ScheduleDay"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday, saturday, + sunday. Known values are: \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", + \"Saturday\", and \"Sunday\".""" + + @overload + def __init__( + self, + *, + occurrence: Optional[int] = None, + day: Optional[Union[str, "_models.ScheduleDay"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AgentRegistration(_Model): + """Definition of the agent registration information type. + + :ivar dsc_meta_configuration: Gets or sets the dsc meta configuration. + :vartype dsc_meta_configuration: str + :ivar endpoint: Gets or sets the dsc server endpoint. + :vartype endpoint: str + :ivar keys_property: Gets or sets the agent registration keys. + :vartype keys_property: ~azure.mgmt.automation.models.AgentRegistrationKeys + :ivar id: Gets or sets the id. + :vartype id: str + """ + + dsc_meta_configuration: Optional[str] = rest_field( + name="dscMetaConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the dsc meta configuration.""" + endpoint: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the dsc server endpoint.""" + keys_property: Optional["_models.AgentRegistrationKeys"] = rest_field( + name="keys", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="keys" + ) + """Gets or sets the agent registration keys.""" + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the id.""" + + @overload + def __init__( + self, + *, + dsc_meta_configuration: Optional[str] = None, + endpoint: Optional[str] = None, + keys_property: Optional["_models.AgentRegistrationKeys"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AgentRegistrationKeys(_Model): + """Definition of the agent registration keys. + + :ivar primary: Gets or sets the primary key. + :vartype primary: str + :ivar secondary: Gets or sets the secondary key. + :vartype secondary: str + """ + + primary: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the primary key.""" + secondary: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the secondary key.""" + + @overload + def __init__( + self, + *, + primary: Optional[str] = None, + secondary: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AgentRegistrationRegenerateKeyParameter(_Model): + """The parameters supplied to the regenerate keys operation. + + :ivar key_name: Gets or sets the agent registration key name - primary or secondary. Required. + Known values are: "primary" and "secondary". + :vartype key_name: str or ~azure.mgmt.automation.models.AgentRegistrationKeyName + """ + + key_name: Union[str, "_models.AgentRegistrationKeyName"] = rest_field( + name="keyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the agent registration key name - primary or secondary. Required. Known values + are: \"primary\" and \"secondary\".""" + + @overload + def __init__( + self, + *, + key_name: Union[str, "_models.AgentRegistrationKeyName"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Resource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class TrackedResource(Resource): + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutomationAccount(TrackedResource): + """Definition of the automation account type. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Gets or sets the automation account properties. + :vartype properties: ~azure.mgmt.automation.models.AutomationAccountProperties + :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 + """ + + properties: Optional["_models.AutomationAccountProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the automation account properties.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the etag of the resource.""" + identity: Optional["_models.Identity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Identity for the resource.""" + + __flattened_items = [ + "sku", + "last_modified_by", + "state", + "creation_time", + "last_modified_time", + "description", + "encryption", + "private_endpoint_connections", + "public_network_access", + "disable_local_auth", + "automation_hybrid_service_url", + ] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.AutomationAccountProperties"] = None, + etag: Optional[str] = None, + identity: Optional["_models.Identity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class AutomationAccountCreateOrUpdateParameters(_Model): # pylint: disable=name-too-long + """The parameters supplied to the create or update automation account operation. + + :ivar properties: Gets or sets account create or update properties. + :vartype properties: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateProperties + :ivar name: Gets or sets name of the resource. + :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] + """ + + properties: Optional["_models.AutomationAccountCreateOrUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets account create or update properties.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets name of the resource.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the location of the resource.""" + identity: Optional["_models.Identity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Sets the identity property for automation account.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the tags attached to the resource.""" + + __flattened_items = ["sku", "encryption", "public_network_access", "disable_local_auth"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.AutomationAccountCreateOrUpdateProperties"] = None, + name: Optional[str] = None, + location: Optional[str] = None, + identity: Optional["_models.Identity"] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class AutomationAccountCreateOrUpdateProperties(_Model): # pylint: disable=name-too-long + """The parameters supplied to the create or update account properties. + + :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 + """ + + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets account SKU.""" + encryption: Optional["_models.EncryptionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Set the encryption properties for the automation account.""" + public_network_access: Optional[bool] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether traffic on the non-ARM endpoint (Webhook/Agent) is allowed from the public + internet.""" + disable_local_auth: Optional[bool] = rest_field( + name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether requests using non-AAD authentication are blocked.""" + + @overload + def __init__( + self, + *, + sku: Optional["_models.Sku"] = None, + encryption: Optional["_models.EncryptionProperties"] = None, + public_network_access: Optional[bool] = None, + disable_local_auth: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutomationAccountProperties(_Model): + """Definition of the account property. + + :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. + :vartype last_modified_by: str + :ivar state: Gets status of account. Known values are: "Ok", "Unavailable", and "Suspended". + :vartype state: str or ~azure.mgmt.automation.models.AutomationAccountState + :ivar creation_time: Gets the creation time. + :vartype creation_time: ~datetime.datetime + :ivar last_modified_time: Gets the last modified time. + :vartype last_modified_time: ~datetime.datetime + :ivar description: Gets or sets the description. + :vartype description: str + :ivar 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 + """ + + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the SKU of account.""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the last modified by.""" + state: Optional[Union[str, "_models.AutomationAccountState"]] = rest_field(visibility=["read"]) + """Gets status of account. Known values are: \"Ok\", \"Unavailable\", and \"Suspended\".""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Gets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read"], format="rfc3339" + ) + """Gets the last modified time.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + encryption: Optional["_models.EncryptionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Encryption properties for the automation account.""" + private_endpoint_connections: Optional[list["_models.PrivateEndpointConnection"]] = rest_field( + name="privateEndpointConnections", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Automation operations supported by the Automation resource provider.""" + public_network_access: Optional[bool] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether traffic on the non-ARM endpoint (Webhook/Agent) is allowed from the public + internet.""" + disable_local_auth: Optional[bool] = rest_field( + name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether requests using non-AAD authentication are blocked.""" + automation_hybrid_service_url: Optional[str] = rest_field( + name="automationHybridServiceUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """URL of automation hybrid service which is used for hybrid worker on-boarding.""" + + @overload + def __init__( + self, + *, + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutomationAccountUpdateParameters(_Model): + """The parameters supplied to the update automation account operation. + + :ivar properties: Gets or sets account update properties. + :vartype properties: ~azure.mgmt.automation.models.AutomationAccountUpdateProperties + :ivar name: Gets or sets the name of the resource. + :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] + """ + + properties: Optional["_models.AutomationAccountUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets account update properties.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the resource.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the location of the resource.""" + identity: Optional["_models.Identity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Sets the identity property for automation account.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the tags attached to the resource.""" + + __flattened_items = ["sku", "encryption", "public_network_access", "disable_local_auth"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.AutomationAccountUpdateProperties"] = None, + name: Optional[str] = None, + location: Optional[str] = None, + identity: Optional["_models.Identity"] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class AutomationAccountUpdateProperties(_Model): + """The parameters supplied to the update account properties. + + :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 + """ + + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets account SKU.""" + encryption: Optional["_models.EncryptionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Set the encryption properties for the automation account.""" + public_network_access: Optional[bool] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether traffic on the non-ARM endpoint (Webhook/Agent) is allowed from the public + internet.""" + disable_local_auth: Optional[bool] = rest_field( + name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether requests using non-AAD authentication are blocked.""" + + @overload + def __init__( + self, + *, + sku: Optional["_models.Sku"] = None, + encryption: Optional["_models.EncryptionProperties"] = None, + public_network_access: Optional[bool] = None, + disable_local_auth: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AutomationErrorResponse(_Model): + """Error response of an operation failure. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error code.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error message indicating why the operation failed.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureQueryProperties(_Model): + """Azure query for the update configuration. + + :ivar scope: List of Subscription or Resource Group ARM Ids. + :vartype scope: list[str] + :ivar locations: List of locations to scope the query to. + :vartype locations: list[str] + :ivar tag_settings: Tag settings for the VM. + :vartype tag_settings: ~azure.mgmt.automation.models.TagSettingsProperties + """ + + scope: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """List of Subscription or Resource Group ARM Ids.""" + locations: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """List of locations to scope the query to.""" + tag_settings: Optional["_models.TagSettingsProperties"] = rest_field( + name="tagSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Tag settings for the VM.""" + + @overload + def __init__( + self, + *, + scope: Optional[list[str]] = None, + locations: Optional[list[str]] = None, + tag_settings: Optional["_models.TagSettingsProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + """ + + +class Certificate(ProxyResource): + """Definition of the certificate. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Gets or sets the properties of the certificate. + :vartype properties: ~azure.mgmt.automation.models.CertificateProperties + """ + + properties: Optional["_models.CertificateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the certificate.""" + + __flattened_items = [ + "thumbprint", + "expiry_time", + "is_exportable", + "creation_time", + "last_modified_time", + "description", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.CertificateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class CertificateCreateOrUpdateParameters(_Model): + """The parameters supplied to the create or update or replace certificate operation. + + :ivar name: Gets or sets the name of the certificate. Required. + :vartype name: str + :ivar properties: Gets or sets the properties of the certificate. Required. + :vartype properties: ~azure.mgmt.automation.models.CertificateCreateOrUpdateProperties + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the certificate. Required.""" + properties: "_models.CertificateCreateOrUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the certificate. Required.""" + + __flattened_items = ["base64_value", "description", "thumbprint", "is_exportable"] + + @overload + def __init__( + self, + *, + name: str, + properties: "_models.CertificateCreateOrUpdateProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class CertificateCreateOrUpdateProperties(_Model): + """The properties of the create certificate operation. + + :ivar base64_value: Gets or sets the base64 encoded value of the certificate. Required. + :vartype base64_value: str + :ivar description: Gets or sets the description of the certificate. + :vartype description: str + :ivar thumbprint: Gets or sets the thumbprint of the certificate. + :vartype thumbprint: str + :ivar is_exportable: Gets or sets the is exportable flag of the certificate. + :vartype is_exportable: bool + """ + + base64_value: str = rest_field(name="base64Value", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the base64 encoded value of the certificate. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the certificate.""" + thumbprint: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the thumbprint of the certificate.""" + is_exportable: Optional[bool] = rest_field( + name="isExportable", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the is exportable flag of the certificate.""" + + @overload + def __init__( + self, + *, + base64_value: str, + description: Optional[str] = None, + thumbprint: Optional[str] = None, + is_exportable: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CertificateProperties(_Model): + """Properties of the certificate. + + :ivar thumbprint: Gets the thumbprint of the certificate. + :vartype thumbprint: str + :ivar expiry_time: Gets the expiry time of the certificate. + :vartype expiry_time: ~datetime.datetime + :ivar is_exportable: Gets the is exportable flag of the certificate. + :vartype is_exportable: bool + :ivar creation_time: Gets the creation time. + :vartype creation_time: ~datetime.datetime + :ivar last_modified_time: Gets the last modified time. + :vartype last_modified_time: ~datetime.datetime + :ivar description: Gets or sets the description. + :vartype description: str + """ + + thumbprint: Optional[str] = rest_field(visibility=["read"]) + """Gets the thumbprint of the certificate.""" + expiry_time: Optional[datetime.datetime] = rest_field(name="expiryTime", visibility=["read"], format="rfc3339") + """Gets the expiry time of the certificate.""" + is_exportable: Optional[bool] = rest_field(name="isExportable", visibility=["read"]) + """Gets the is exportable flag of the certificate.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Gets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read"], format="rfc3339" + ) + """Gets the last modified time.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CertificateUpdateParameters(_Model): + """The parameters supplied to the update certificate operation. + + :ivar name: Gets or sets the name of the certificate. + :vartype name: str + :ivar properties: Gets or sets the properties of the certificate. + :vartype properties: ~azure.mgmt.automation.models.CertificateUpdateProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the certificate.""" + properties: Optional["_models.CertificateUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the certificate.""" + + __flattened_items = ["description"] + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.CertificateUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class CertificateUpdateProperties(_Model): + """The properties of the update certificate operation. + + :ivar description: Gets or sets the description of the certificate. + :vartype description: str + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the certificate.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Connection(ProxyResource): + """Definition of the connection. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Gets or sets the properties of the connection. + :vartype properties: ~azure.mgmt.automation.models.ConnectionProperties + """ + + properties: Optional["_models.ConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the connection.""" + + __flattened_items = [ + "connection_type", + "field_definition_values", + "creation_time", + "last_modified_time", + "description", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ConnectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ConnectionCreateOrUpdateParameters(_Model): + """The parameters supplied to the create or update connection operation. + + :ivar name: Gets or sets the name of the connection. Required. + :vartype name: str + :ivar properties: Gets or sets the properties of the connection. Required. + :vartype properties: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateProperties + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the connection. Required.""" + properties: "_models.ConnectionCreateOrUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the connection. Required.""" + + __flattened_items = ["description", "connection_type", "field_definition_values"] + + @overload + def __init__( + self, + *, + name: str, + properties: "_models.ConnectionCreateOrUpdateProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ConnectionCreateOrUpdateProperties(_Model): + """The properties of the create connection properties. + + :ivar description: Gets or sets the description of the connection. + :vartype description: str + :ivar connection_type: Gets or sets the connectionType of the connection. Required. + :vartype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty + :ivar field_definition_values: Gets or sets the field definition properties of the connection. + :vartype field_definition_values: dict[str, str] + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the connection.""" + connection_type: "_models.ConnectionTypeAssociationProperty" = rest_field( + name="connectionType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the connectionType of the connection. Required.""" + field_definition_values: Optional[dict[str, str]] = rest_field( + name="fieldDefinitionValues", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the field definition properties of the connection.""" + + @overload + def __init__( + self, + *, + connection_type: "_models.ConnectionTypeAssociationProperty", + description: Optional[str] = None, + field_definition_values: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConnectionProperties(_Model): + """Definition of the connection properties. + + :ivar connection_type: Gets or sets the connectionType of the connection. + :vartype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty + :ivar field_definition_values: Gets the field definition values of the connection. + :vartype field_definition_values: dict[str, str] + :ivar creation_time: Gets the creation time. + :vartype creation_time: ~datetime.datetime + :ivar last_modified_time: Gets the last modified time. + :vartype last_modified_time: ~datetime.datetime + :ivar description: Gets or sets the description. + :vartype description: str + """ + + connection_type: Optional["_models.ConnectionTypeAssociationProperty"] = rest_field( + name="connectionType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the connectionType of the connection.""" + field_definition_values: Optional[dict[str, str]] = rest_field(name="fieldDefinitionValues", visibility=["read"]) + """Gets the field definition values of the connection.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Gets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read"], format="rfc3339" + ) + """Gets the last modified time.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + + @overload + def __init__( + self, + *, + connection_type: Optional["_models.ConnectionTypeAssociationProperty"] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConnectionType(ProxyResource): + """Definition of the connection type. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Gets or sets the properties of the connection type. + :vartype properties: ~azure.mgmt.automation.models.ConnectionTypeProperties + """ + + properties: Optional["_models.ConnectionTypeProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the connection type.""" + + __flattened_items = ["is_global", "field_definitions", "creation_time", "last_modified_time", "description"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ConnectionTypeProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ConnectionTypeAssociationProperty(_Model): + """The connection type property associated with the entity. + + :ivar name: Gets or sets the name of the connection type. + :vartype name: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the connection type.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConnectionTypeCreateOrUpdateParameters(_Model): + """The parameters supplied to the create or update connection type operation. + + :ivar name: Gets or sets the name of the connection type. Required. + :vartype name: str + :ivar properties: Gets or sets the value of the connection type. Required. + :vartype properties: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateProperties + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the connection type. Required.""" + properties: "_models.ConnectionTypeCreateOrUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the value of the connection type. Required.""" + + __flattened_items = ["is_global", "field_definitions"] + + @overload + def __init__( + self, + *, + name: str, + properties: "_models.ConnectionTypeCreateOrUpdateProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ConnectionTypeCreateOrUpdateProperties(_Model): + """The properties of the create connection type. + + :ivar is_global: Gets or sets a Boolean value to indicate if the connection type is global. + :vartype is_global: bool + :ivar field_definitions: Gets or sets the field definitions of the connection type. Required. + :vartype field_definitions: dict[str, ~azure.mgmt.automation.models.FieldDefinition] + """ + + is_global: Optional[bool] = rest_field(name="isGlobal", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets a Boolean value to indicate if the connection type is global.""" + field_definitions: dict[str, "_models.FieldDefinition"] = rest_field( + name="fieldDefinitions", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the field definitions of the connection type. Required.""" + + @overload + def __init__( + self, + *, + field_definitions: dict[str, "_models.FieldDefinition"], + is_global: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConnectionTypeProperties(_Model): + """Properties of the connection type. + + :ivar is_global: Gets or sets a Boolean value to indicate if the connection type is global. + :vartype is_global: bool + :ivar field_definitions: Gets the field definitions of the connection type. + :vartype field_definitions: dict[str, ~azure.mgmt.automation.models.FieldDefinition] + :ivar creation_time: Gets 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 + """ + + is_global: Optional[bool] = rest_field(name="isGlobal", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets a Boolean value to indicate if the connection type is global.""" + field_definitions: Optional[dict[str, "_models.FieldDefinition"]] = rest_field( + name="fieldDefinitions", visibility=["read"] + ) + """Gets the field definitions of the connection type.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Gets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + + @overload + def __init__( + self, + *, + is_global: Optional[bool] = None, + last_modified_time: Optional[datetime.datetime] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConnectionUpdateParameters(_Model): + """The parameters supplied to the update connection operation. + + :ivar name: Gets or sets the name of the connection. + :vartype name: str + :ivar properties: Gets or sets the properties of the connection. + :vartype properties: ~azure.mgmt.automation.models.ConnectionUpdateProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the connection.""" + properties: Optional["_models.ConnectionUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the connection.""" + + __flattened_items = ["description", "field_definition_values"] + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.ConnectionUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ConnectionUpdateProperties(_Model): + """The properties of the update connection operation. + + :ivar description: Gets or sets the description of the connection. + :vartype description: str + :ivar field_definition_values: Gets or sets the field definition values of the connection. + :vartype field_definition_values: dict[str, str] + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the connection.""" + field_definition_values: Optional[dict[str, str]] = rest_field( + name="fieldDefinitionValues", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the field definition values of the connection.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + field_definition_values: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContentHash(_Model): + """Definition of the runbook property type. + + :ivar algorithm: Gets or sets the content hash algorithm used to hash the content. Required. + :vartype algorithm: str + :ivar value: Gets or sets expected hash value of the content. Required. + :vartype value: str + """ + + algorithm: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the content hash algorithm used to hash the content. Required.""" + value: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets expected hash value of the content. Required.""" + + @overload + def __init__( + self, + *, + algorithm: str, + value: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContentLink(_Model): + """Definition of the content link. + + :ivar uri: Gets or sets the uri of content. + :vartype uri: str + :ivar content_hash: Gets or sets the hash. + :vartype content_hash: ~azure.mgmt.automation.models.ContentHash + :ivar version: Gets or sets the version of the content. + :vartype version: str + """ + + uri: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the uri of content.""" + content_hash: Optional["_models.ContentHash"] = rest_field( + name="contentHash", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the hash.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the version of the content.""" + + @overload + def __init__( + self, + *, + uri: Optional[str] = None, + content_hash: Optional["_models.ContentHash"] = None, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContentSource(_Model): + """Definition of the content source. + + :ivar hash: Gets or sets the hash. + :vartype hash: ~azure.mgmt.automation.models.ContentHash + :ivar type: Gets or sets the content source type. Known values are: "embeddedContent" and + "uri". + :vartype type: str or ~azure.mgmt.automation.models.ContentSourceType + :ivar value: Gets or sets the value of the content. This is based on the content source type. + :vartype value: str + :ivar version: Gets or sets the version of the content. + :vartype version: str + """ + + hash: Optional["_models.ContentHash"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the hash.""" + type: Optional[Union[str, "_models.ContentSourceType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the content source type. Known values are: \"embeddedContent\" and \"uri\".""" + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the value of the content. This is based on the content source type.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the version of the content.""" + + @overload + def __init__( + self, + *, + hash: Optional["_models.ContentHash"] = None, + type: Optional[Union[str, "_models.ContentSourceType"]] = None, + value: Optional[str] = None, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Credential(ProxyResource): + """Definition of the credential. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Gets or sets the properties of the credential. + :vartype properties: ~azure.mgmt.automation.models.CredentialProperties + """ + + properties: Optional["_models.CredentialProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the credential.""" + + __flattened_items = ["user_name", "creation_time", "last_modified_time", "description"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.CredentialProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class CredentialCreateOrUpdateParameters(_Model): + """The parameters supplied to the create or update credential operation. + + :ivar name: Gets or sets the name of the credential. Required. + :vartype name: str + :ivar properties: Gets or sets the properties of the credential. Required. + :vartype properties: ~azure.mgmt.automation.models.CredentialCreateOrUpdateProperties + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the credential. Required.""" + properties: "_models.CredentialCreateOrUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the credential. Required.""" + + __flattened_items = ["user_name", "password", "description"] + + @overload + def __init__( + self, + *, + name: str, + properties: "_models.CredentialCreateOrUpdateProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class CredentialCreateOrUpdateProperties(_Model): + """The properties of the create credential operation. + + :ivar user_name: Gets or sets the user name of the credential. Required. + :vartype user_name: str + :ivar password: Gets or sets the password of the credential. Required. + :vartype password: str + :ivar description: Gets or sets the description of the credential. + :vartype description: str + """ + + user_name: str = rest_field(name="userName", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the user name of the credential. Required.""" + password: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the password of the credential. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the credential.""" + + @overload + def __init__( + self, + *, + user_name: str, + password: str, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CredentialProperties(_Model): + """Definition of the credential properties. + + :ivar user_name: Gets the user name of the credential. + :vartype user_name: str + :ivar creation_time: Gets the creation time. + :vartype creation_time: ~datetime.datetime + :ivar last_modified_time: Gets the last modified time. + :vartype last_modified_time: ~datetime.datetime + :ivar description: Gets or sets the description. + :vartype description: str + """ + + user_name: Optional[str] = rest_field(name="userName", visibility=["read"]) + """Gets the user name of the credential.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Gets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read"], format="rfc3339" + ) + """Gets the last modified time.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CredentialUpdateParameters(_Model): + """The parameters supplied to the Update credential operation. + + :ivar name: Gets or sets the name of the credential. + :vartype name: str + :ivar properties: Gets or sets the properties of the variable. + :vartype properties: ~azure.mgmt.automation.models.CredentialUpdateProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the credential.""" + properties: Optional["_models.CredentialUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the variable.""" + + __flattened_items = ["user_name", "password", "description"] + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.CredentialUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class CredentialUpdateProperties(_Model): + """The properties of the Update credential. + + :ivar user_name: Gets or sets the user name of the credential. + :vartype user_name: str + :ivar password: Gets or sets the password of the credential. + :vartype password: str + :ivar description: Gets or sets the description of the credential. + :vartype description: str + """ + + user_name: Optional[str] = rest_field(name="userName", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the user name of the credential.""" + password: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the password of the credential.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the credential.""" + + @overload + def __init__( + self, + *, + user_name: Optional[str] = None, + password: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeletedAutomationAccount(_Model): + """Definition of the deleted automation account type. + + :ivar properties: Gets or sets the automation account properties. + :vartype properties: ~azure.mgmt.automation.models.DeletedAutomationAccountProperties + :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 + """ + + properties: Optional["_models.DeletedAutomationAccountProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the automation account properties.""" + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource id.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets name of the resource.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource type.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the location of the resource.""" + + __flattened_items = ["automation_account_resource_id", "automation_account_id", "location", "deletion_time"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.DeletedAutomationAccountProperties"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DeletedAutomationAccountListResult(_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] + """ + + value: Optional[list["_models.DeletedAutomationAccount"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of deleted automation accounts.""" + + @overload + def __init__( + self, + *, + value: Optional[list["_models.DeletedAutomationAccount"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeletedAutomationAccountProperties(_Model): + """Definition of the deleted automation account properties. + + :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: Gets or sets the location of the resource. + :vartype location: str + :ivar deletion_time: Gets the deletion time. + :vartype deletion_time: ~datetime.datetime + """ + + automation_account_resource_id: Optional[str] = rest_field( + name="automationAccountResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Automation Account Resource Id.""" + automation_account_id: Optional[str] = rest_field( + name="automationAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Automation Account Id.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the location of the resource.""" + deletion_time: Optional[datetime.datetime] = rest_field(name="deletionTime", visibility=["read"], format="rfc3339") + """Gets the deletion time.""" + + @overload + def __init__( + self, + *, + automation_account_resource_id: Optional[str] = None, + automation_account_id: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeletedRunbook(_Model): + """Definition of deleted runbook. + + :ivar properties: Gets or sets the runbook properties. + :vartype properties: ~azure.mgmt.automation.models.DeletedRunbookProperties + :ivar id: The resource id. + :vartype id: str + :ivar name: Gets or sets name of the resource. + :vartype name: str + :ivar location: Gets or sets the location of the resource. + :vartype location: str + """ + + properties: Optional["_models.DeletedRunbookProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the runbook properties.""" + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource id.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets name of the resource.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the location of the resource.""" + + __flattened_items = [ + "runbook_id", + "runbook_type", + "runtime", + "runtime_environment", + "creation_time", + "deletion_time", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.DeletedRunbookProperties"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DeletedRunbookProperties(_Model): + """Definition of the deleted runbook property. + + :ivar runbook_id: Gets or sets the Runbook Id. + :vartype runbook_id: str + :ivar runbook_type: Type of the runbook. + :vartype runbook_type: str + :ivar runtime: Gets or sets runtime of the runbook. + :vartype runtime: str + :ivar runtime_environment: Environment of the runbook. + :vartype runtime_environment: str + :ivar creation_time: Gets or sets the creation time. + :vartype creation_time: ~datetime.datetime + :ivar deletion_time: Gets or sets the last modified time. + :vartype deletion_time: ~datetime.datetime + """ + + runbook_id: Optional[str] = rest_field(name="runbookId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the Runbook Id.""" + runbook_type: Optional[str] = rest_field( + name="runbookType", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of the runbook.""" + runtime: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets runtime of the runbook.""" + runtime_environment: Optional[str] = rest_field( + name="runtimeEnvironment", visibility=["read", "create", "update", "delete", "query"] + ) + """Environment of the runbook.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the creation time.""" + deletion_time: Optional[datetime.datetime] = rest_field( + name="deletionTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time.""" + + @overload + def __init__( + self, + *, + runbook_id: Optional[str] = None, + runbook_type: Optional[str] = None, + runtime: Optional[str] = None, + runtime_environment: Optional[str] = None, + creation_time: Optional[datetime.datetime] = None, + deletion_time: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Dimension(_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 + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the dimension.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """The display name of the dimension.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscConfiguration(TrackedResource): + """Definition of the configuration type. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Gets or sets the configuration properties. + :vartype properties: ~azure.mgmt.automation.models.DscConfigurationProperties + :ivar etag: Gets or sets the etag of the resource. + :vartype etag: str + """ + + properties: Optional["_models.DscConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the configuration properties.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the etag of the resource.""" + + __flattened_items = [ + "provisioning_state", + "job_count", + "parameters", + "source", + "state", + "log_verbose", + "creation_time", + "last_modified_time", + "node_configuration_count", + "description", + ] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.DscConfigurationProperties"] = None, + etag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DscConfigurationAssociationProperty(_Model): + """The Dsc configuration property associated with the entity. + + :ivar name: Gets or sets the name of the Dsc configuration. + :vartype name: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the Dsc configuration.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscConfigurationCreateOrUpdateParameters(_Model): + """The parameters supplied to the create or update configuration operation. + + :ivar properties: Gets or sets configuration create or update properties. Required. + :vartype properties: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateProperties + :ivar name: Gets or sets name of the resource. + :vartype name: str + :ivar location: Gets or sets the location of the resource. + :vartype location: str + :ivar tags: Gets or sets the tags attached to the resource. + :vartype tags: dict[str, str] + """ + + properties: "_models.DscConfigurationCreateOrUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets configuration create or update properties. Required.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets name of the resource.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the location of the resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the tags attached to the resource.""" + + __flattened_items = ["log_verbose", "log_progress", "source", "parameters", "description"] + + @overload + def __init__( + self, + *, + properties: "_models.DscConfigurationCreateOrUpdateProperties", + name: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DscConfigurationCreateOrUpdateProperties(_Model): + """The properties to create or update configuration. + + :ivar log_verbose: Gets or sets verbose log option. + :vartype log_verbose: bool + :ivar log_progress: Gets or sets progress log option. + :vartype log_progress: bool + :ivar source: Gets or sets the source. Required. + :vartype source: ~azure.mgmt.automation.models.ContentSource + :ivar parameters: Gets or sets the configuration parameters. + :vartype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter] + :ivar description: Gets or sets the description of the configuration. + :vartype description: str + """ + + log_verbose: Optional[bool] = rest_field( + name="logVerbose", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets verbose log option.""" + log_progress: Optional[bool] = rest_field( + name="logProgress", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets progress log option.""" + source: "_models.ContentSource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the source. Required.""" + parameters: Optional[dict[str, "_models.DscConfigurationParameter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the configuration parameters.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the configuration.""" + + @overload + def __init__( + self, + *, + source: "_models.ContentSource", + log_verbose: Optional[bool] = None, + log_progress: Optional[bool] = None, + parameters: Optional[dict[str, "_models.DscConfigurationParameter"]] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscConfigurationParameter(_Model): + """Definition of the configuration parameter type. + + :ivar type: Gets or sets the type of the parameter. + :vartype type: str + :ivar is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is mandatory + or not. + :vartype is_mandatory: bool + :ivar position: Get or sets the position of the parameter. + :vartype position: int + :ivar default_value: Gets or sets the default value of parameter. + :vartype default_value: str + """ + + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the type of the parameter.""" + is_mandatory: Optional[bool] = rest_field( + name="isMandatory", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a Boolean value to indicate whether the parameter is mandatory or not.""" + position: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Get or sets the position of the parameter.""" + default_value: Optional[str] = rest_field( + name="defaultValue", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the default value of parameter.""" + + @overload + def __init__( + self, + *, + type: Optional[str] = None, + is_mandatory: Optional[bool] = None, + position: Optional[int] = None, + default_value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscConfigurationProperties(_Model): + """Definition of the configuration property type. + + :ivar provisioning_state: Gets or sets the provisioning state of the configuration. Default + value is "Succeeded". + :vartype provisioning_state: str + :ivar job_count: Gets or sets the job count of the configuration. + :vartype job_count: int + :ivar parameters: Gets or sets the configuration parameters. + :vartype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter] + :ivar source: Gets or sets the source. + :vartype source: ~azure.mgmt.automation.models.ContentSource + :ivar state: Gets or sets the state of the configuration. Known values are: "New", "Edit", and + "Published". + :vartype state: str or ~azure.mgmt.automation.models.DscConfigurationState + :ivar log_verbose: Gets or sets verbose log option. + :vartype log_verbose: bool + :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 node_configuration_count: Gets the number of compiled node configurations. + :vartype node_configuration_count: int + :ivar description: Gets or sets the description. + :vartype description: str + """ + + provisioning_state: Optional[Literal["Succeeded"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the provisioning state of the configuration. Default value is \"Succeeded\".""" + job_count: Optional[int] = rest_field(name="jobCount", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the job count of the configuration.""" + parameters: Optional[dict[str, "_models.DscConfigurationParameter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the configuration parameters.""" + source: Optional["_models.ContentSource"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the source.""" + state: Optional[Union[str, "_models.DscConfigurationState"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the state of the configuration. Known values are: \"New\", \"Edit\", and + \"Published\".""" + log_verbose: Optional[bool] = rest_field( + name="logVerbose", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets verbose log option.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time.""" + node_configuration_count: Optional[int] = rest_field( + name="nodeConfigurationCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the number of compiled node configurations.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + + @overload + def __init__( + self, + *, + provisioning_state: Optional[Literal["Succeeded"]] = None, + job_count: Optional[int] = 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, + creation_time: Optional[datetime.datetime] = None, + last_modified_time: Optional[datetime.datetime] = None, + node_configuration_count: Optional[int] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscConfigurationUpdateParameters(_Model): + """The parameters supplied to the create or update configuration operation. + + :ivar properties: Gets or sets configuration create or update properties. + :vartype properties: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateProperties + :ivar name: Gets or sets name of the resource. + :vartype name: str + :ivar tags: Gets or sets the tags attached to the resource. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.DscConfigurationCreateOrUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets configuration create or update properties.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets name of the resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the tags attached to the resource.""" + + __flattened_items = ["log_verbose", "log_progress", "source", "parameters", "description"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.DscConfigurationCreateOrUpdateProperties"] = None, + name: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DscMetaConfiguration(_Model): + """Definition of the DSC Meta Configuration. + + :ivar configuration_mode_frequency_mins: Gets or sets the ConfigurationModeFrequencyMins value + of the meta configuration. + :vartype configuration_mode_frequency_mins: int + :ivar reboot_node_if_needed: Gets or sets the RebootNodeIfNeeded value of the meta + configuration. + :vartype reboot_node_if_needed: bool + :ivar configuration_mode: Gets or sets the ConfigurationMode value of the meta configuration. + :vartype configuration_mode: str + :ivar action_after_reboot: Gets or sets the ActionAfterReboot value of the meta configuration. + :vartype action_after_reboot: str + :ivar certificate_id: Gets or sets the CertificateId value of the meta configuration. + :vartype certificate_id: str + :ivar refresh_frequency_mins: Gets or sets the RefreshFrequencyMins value of the meta + configuration. + :vartype refresh_frequency_mins: int + :ivar allow_module_overwrite: Gets or sets the AllowModuleOverwrite value of the meta + configuration. + :vartype allow_module_overwrite: bool + """ + + configuration_mode_frequency_mins: Optional[int] = rest_field( + name="configurationModeFrequencyMins", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ConfigurationModeFrequencyMins value of the meta configuration.""" + reboot_node_if_needed: Optional[bool] = rest_field( + name="rebootNodeIfNeeded", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the RebootNodeIfNeeded value of the meta configuration.""" + configuration_mode: Optional[str] = rest_field( + name="configurationMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ConfigurationMode value of the meta configuration.""" + action_after_reboot: Optional[str] = rest_field( + name="actionAfterReboot", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ActionAfterReboot value of the meta configuration.""" + certificate_id: Optional[str] = rest_field( + name="certificateId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the CertificateId value of the meta configuration.""" + refresh_frequency_mins: Optional[int] = rest_field( + name="refreshFrequencyMins", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the RefreshFrequencyMins value of the meta configuration.""" + allow_module_overwrite: Optional[bool] = rest_field( + name="allowModuleOverwrite", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the AllowModuleOverwrite value of the meta configuration.""" + + @overload + def __init__( + self, + *, + configuration_mode_frequency_mins: Optional[int] = None, + reboot_node_if_needed: Optional[bool] = None, + configuration_mode: Optional[str] = None, + action_after_reboot: Optional[str] = None, + certificate_id: Optional[str] = None, + refresh_frequency_mins: Optional[int] = None, + allow_module_overwrite: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscNode(ProxyResource): + """Definition of a DscNode. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: The properties of a DscNode. + :vartype properties: ~azure.mgmt.automation.models.DscNodeProperties + """ + + properties: Optional["_models.DscNodeProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of a DscNode.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DscNodeProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscNodeConfiguration(ProxyResource): + """Definition of the dsc node configuration. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Gets or sets the configuration properties. + :vartype properties: ~azure.mgmt.automation.models.DscNodeConfigurationProperties + """ + + properties: Optional["_models.DscNodeConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the configuration properties.""" + + __flattened_items = [ + "last_modified_time", + "creation_time", + "configuration", + "source", + "node_count", + "increment_node_configuration_build", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.DscNodeConfigurationProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DscNodeConfigurationAssociationProperty(_Model): + """The dsc node configuration property associated with the entity. + + :ivar name: Gets or sets the name of the dsc node configuration. + :vartype name: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the dsc node configuration.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscNodeConfigurationCreateOrUpdateParameters(_Model): # pylint: disable=name-too-long + """The parameters supplied to the create or update node configuration operation. + + :ivar properties: Node configuration properties. + :vartype properties: + ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParametersProperties + :ivar name: Name of the node configuration. + :vartype name: str + :ivar tags: Gets or sets the tags attached to the resource. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.DscNodeConfigurationCreateOrUpdateParametersProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Node configuration properties.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the node configuration.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the tags attached to the resource.""" + + __flattened_items = ["source", "configuration", "increment_node_configuration_build"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.DscNodeConfigurationCreateOrUpdateParametersProperties"] = None, + name: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DscNodeConfigurationCreateOrUpdateParametersProperties(_Model): # pylint: disable=name-too-long + """The parameter properties supplied to the create or update node configuration operation. + + :ivar source: Gets or sets the source. Required. + :vartype source: ~azure.mgmt.automation.models.ContentSource + :ivar configuration: Gets or sets the configuration of the node. Required. + :vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty + :ivar increment_node_configuration_build: If a new build version of NodeConfiguration is + required. + :vartype increment_node_configuration_build: bool + """ + + source: "_models.ContentSource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the source. Required.""" + configuration: "_models.DscConfigurationAssociationProperty" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the configuration of the node. Required.""" + increment_node_configuration_build: Optional[bool] = rest_field( + name="incrementNodeConfigurationBuild", visibility=["read", "create", "update", "delete", "query"] + ) + """If a new build version of NodeConfiguration is required.""" + + @overload + def __init__( + self, + *, + source: "_models.ContentSource", + configuration: "_models.DscConfigurationAssociationProperty", + increment_node_configuration_build: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscNodeConfigurationProperties(_Model): + """Properties for the DscNodeConfiguration. + + :ivar last_modified_time: Gets or sets the last modified time. + :vartype last_modified_time: ~datetime.datetime + :ivar creation_time: Gets or sets creation time. + :vartype creation_time: ~datetime.datetime + :ivar configuration: Gets or sets the configuration of the node. + :vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty + :ivar source: Source of node configuration. + :vartype source: str + :ivar node_count: Number of nodes with this node configuration assigned. + :vartype node_count: int + :ivar increment_node_configuration_build: If a new build version of NodeConfiguration is + required. + :vartype increment_node_configuration_build: bool + """ + + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets creation time.""" + configuration: Optional["_models.DscConfigurationAssociationProperty"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the configuration of the node.""" + source: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Source of node configuration.""" + node_count: Optional[int] = rest_field(name="nodeCount", visibility=["read", "create", "update", "delete", "query"]) + """Number of nodes with this node configuration assigned.""" + increment_node_configuration_build: Optional[bool] = rest_field( + name="incrementNodeConfigurationBuild", visibility=["read", "create", "update", "delete", "query"] + ) + """If a new build version of NodeConfiguration is required.""" + + @overload + def __init__( + self, + *, + last_modified_time: Optional[datetime.datetime] = None, + creation_time: Optional[datetime.datetime] = None, + configuration: Optional["_models.DscConfigurationAssociationProperty"] = None, + source: Optional[str] = None, + node_count: Optional[int] = None, + increment_node_configuration_build: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscNodeExtensionHandlerAssociationProperty(_Model): # pylint: disable=name-too-long + """The dsc extensionHandler property associated with the node. + + :ivar name: Gets or sets the name of the extension handler. + :vartype name: str + :ivar version: Gets or sets the version of the extension handler. + :vartype version: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the extension handler.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the version of the extension handler.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscNodeProperties(_Model): + """The properties of a DscNode. + + :ivar last_seen: Gets or sets the last seen time of the node. + :vartype last_seen: ~datetime.datetime + :ivar registration_time: Gets or sets the registration time of the node. + :vartype registration_time: ~datetime.datetime + :ivar ip: Gets or sets the ip of the node. + :vartype ip: str + :ivar account_id: Gets or sets the account id of the node. + :vartype account_id: str + :ivar node_configuration: Gets or sets the configuration of the node. + :vartype node_configuration: + ~azure.mgmt.automation.models.DscNodeConfigurationAssociationProperty + :ivar status: Gets or sets the status of the node. + :vartype status: str + :ivar node_id: Gets or sets the node id. + :vartype node_id: str + :ivar etag: Gets or sets the etag of the resource. + :vartype etag: str + :ivar total_count: Gets the total number of records matching filter criteria. + :vartype total_count: int + :ivar extension_handler: Gets or sets the list of extensionHandler properties for a Node. + :vartype extension_handler: + list[~azure.mgmt.automation.models.DscNodeExtensionHandlerAssociationProperty] + """ + + last_seen: Optional[datetime.datetime] = rest_field( + name="lastSeen", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last seen time of the node.""" + registration_time: Optional[datetime.datetime] = rest_field( + name="registrationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the registration time of the node.""" + ip: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the ip of the node.""" + account_id: Optional[str] = rest_field(name="accountId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the account id of the node.""" + node_configuration: Optional["_models.DscNodeConfigurationAssociationProperty"] = rest_field( + name="nodeConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the configuration of the node.""" + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the status of the node.""" + node_id: Optional[str] = rest_field(name="nodeId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the node id.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the etag of the resource.""" + total_count: Optional[int] = rest_field( + name="totalCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the total number of records matching filter criteria.""" + extension_handler: Optional[list["_models.DscNodeExtensionHandlerAssociationProperty"]] = rest_field( + name="extensionHandler", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of extensionHandler properties for a Node.""" + + __flattened_items = ["name"] + + @overload + def __init__( + self, + *, + last_seen: Optional[datetime.datetime] = None, + registration_time: Optional[datetime.datetime] = None, + ip: Optional[str] = None, + account_id: Optional[str] = None, + node_configuration: Optional["_models.DscNodeConfigurationAssociationProperty"] = None, + status: Optional[str] = None, + node_id: Optional[str] = None, + etag: Optional[str] = None, + total_count: Optional[int] = None, + extension_handler: Optional[list["_models.DscNodeExtensionHandlerAssociationProperty"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.node_configuration is None: + return None + return getattr(self.node_configuration, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.node_configuration is None: + self.node_configuration = self._attr_to_rest_field["node_configuration"]._class_type() + setattr(self.node_configuration, key, value) + else: + super().__setattr__(key, value) + + +class DscNodeReport(_Model): + """Definition of the dsc node report type. + + :ivar end_time: Gets or sets the end time of the node report. + :vartype end_time: ~datetime.datetime + :ivar last_modified_time: Gets or sets the lastModifiedTime of the node report. + :vartype last_modified_time: ~datetime.datetime + :ivar start_time: Gets or sets the start time of the node report. + :vartype start_time: ~datetime.datetime + :ivar type: Gets or sets the type of the node report. + :vartype type: str + :ivar report_id: Gets or sets the id of the node report. + :vartype report_id: str + :ivar status: Gets or sets the status of the node report. + :vartype status: str + :ivar refresh_mode: Gets or sets the refreshMode of the node report. + :vartype refresh_mode: str + :ivar reboot_requested: Gets or sets the rebootRequested of the node report. + :vartype reboot_requested: str + :ivar report_format_version: Gets or sets the reportFormatVersion of the node report. + :vartype report_format_version: str + :ivar configuration_version: Gets or sets the configurationVersion of the node report. + :vartype configuration_version: str + :ivar id: Gets or sets the id. + :vartype id: str + :ivar errors: Gets or sets the errors for the node report. + :vartype errors: list[~azure.mgmt.automation.models.DscReportError] + :ivar resources: Gets or sets the resource for the node report. + :vartype resources: list[~azure.mgmt.automation.models.DscReportResource] + :ivar meta_configuration: Gets or sets the metaConfiguration of the node at the time of the + report. + :vartype meta_configuration: ~azure.mgmt.automation.models.DscMetaConfiguration + :ivar host_name: Gets or sets the hostname of the node that sent the report. + :vartype host_name: str + :ivar i_pv4_addresses: Gets or sets the IPv4 address of the node that sent the report. + :vartype i_pv4_addresses: list[str] + :ivar i_pv6_addresses: Gets or sets the IPv6 address of the node that sent the report. + :vartype i_pv6_addresses: list[str] + :ivar number_of_resources: Gets or sets the number of resource in the node report. + :vartype number_of_resources: int + :ivar raw_errors: Gets or sets the unparsed errors for the node report. + :vartype raw_errors: str + """ + + end_time: Optional[datetime.datetime] = rest_field( + name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the end time of the node report.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the lastModifiedTime of the node report.""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the start time of the node report.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the type of the node report.""" + report_id: Optional[str] = rest_field(name="reportId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the id of the node report.""" + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the status of the node report.""" + refresh_mode: Optional[str] = rest_field( + name="refreshMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the refreshMode of the node report.""" + reboot_requested: Optional[str] = rest_field( + name="rebootRequested", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the rebootRequested of the node report.""" + report_format_version: Optional[str] = rest_field( + name="reportFormatVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the reportFormatVersion of the node report.""" + configuration_version: Optional[str] = rest_field( + name="configurationVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the configurationVersion of the node report.""" + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the id.""" + errors: Optional[list["_models.DscReportError"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the errors for the node report.""" + resources: Optional[list["_models.DscReportResource"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the resource for the node report.""" + meta_configuration: Optional["_models.DscMetaConfiguration"] = rest_field( + name="metaConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the metaConfiguration of the node at the time of the report.""" + host_name: Optional[str] = rest_field(name="hostName", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the hostname of the node that sent the report.""" + i_pv4_addresses: Optional[list[str]] = rest_field( + name="iPV4Addresses", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the IPv4 address of the node that sent the report.""" + i_pv6_addresses: Optional[list[str]] = rest_field( + name="iPV6Addresses", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the IPv6 address of the node that sent the report.""" + number_of_resources: Optional[int] = rest_field( + name="numberOfResources", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the number of resource in the node report.""" + raw_errors: Optional[str] = rest_field(name="rawErrors", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the unparsed errors for the node report.""" + + @overload + def __init__( + self, + *, + end_time: Optional[datetime.datetime] = None, + last_modified_time: Optional[datetime.datetime] = None, + start_time: Optional[datetime.datetime] = None, + type: Optional[str] = None, + report_id: Optional[str] = None, + status: Optional[str] = None, + refresh_mode: Optional[str] = None, + reboot_requested: Optional[str] = None, + 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, + 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, + number_of_resources: Optional[int] = None, + raw_errors: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscNodeUpdateParameters(_Model): + """The parameters supplied to the update dsc node operation. + + :ivar node_id: Gets or sets the id of the dsc node. + :vartype node_id: str + :ivar properties: + :vartype properties: ~azure.mgmt.automation.models.DscNodeUpdateParametersProperties + """ + + node_id: Optional[str] = rest_field(name="nodeId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the id of the dsc node.""" + properties: Optional["_models.DscNodeUpdateParametersProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + node_id: Optional[str] = None, + properties: Optional["_models.DscNodeUpdateParametersProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscNodeUpdateParametersProperties(_Model): + """DscNodeUpdateParametersProperties. + + :ivar node_configuration: Gets or sets the configuration of the node. + :vartype node_configuration: + ~azure.mgmt.automation.models.DscNodeConfigurationAssociationProperty + """ + + node_configuration: Optional["_models.DscNodeConfigurationAssociationProperty"] = rest_field( + name="nodeConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the configuration of the node.""" + + __flattened_items = ["name"] + + @overload + def __init__( + self, + *, + node_configuration: Optional["_models.DscNodeConfigurationAssociationProperty"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.node_configuration is None: + return None + return getattr(self.node_configuration, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.node_configuration is None: + self.node_configuration = self._attr_to_rest_field["node_configuration"]._class_type() + setattr(self.node_configuration, key, value) + else: + super().__setattr__(key, value) + + +class DscReportError(_Model): + """Definition of the dsc node report error type. + + :ivar error_source: Gets or sets the source of the error. + :vartype error_source: str + :ivar resource_id: Gets or sets the resource ID which generated the error. + :vartype resource_id: str + :ivar error_code: Gets or sets the error code. + :vartype error_code: str + :ivar error_message: Gets or sets the error message. + :vartype error_message: str + :ivar locale: Gets or sets the locale of the error. + :vartype locale: str + :ivar error_details: Gets or sets the error details. + :vartype error_details: str + """ + + error_source: Optional[str] = rest_field( + name="errorSource", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the source of the error.""" + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the resource ID which generated the error.""" + error_code: Optional[str] = rest_field(name="errorCode", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the error code.""" + error_message: Optional[str] = rest_field( + name="errorMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the error message.""" + locale: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the locale of the error.""" + error_details: Optional[str] = rest_field( + name="errorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the error details.""" + + @overload + def __init__( + self, + *, + error_source: Optional[str] = None, + resource_id: Optional[str] = None, + error_code: Optional[str] = None, + error_message: Optional[str] = None, + locale: Optional[str] = None, + error_details: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscReportResource(_Model): + """Definition of the DSC Report Resource. + + :ivar resource_id: Gets or sets the ID of the resource. + :vartype resource_id: str + :ivar source_info: Gets or sets the source info of the resource. + :vartype source_info: str + :ivar depends_on: Gets or sets the Resource Navigation values for resources the resource + depends on. + :vartype depends_on: list[~azure.mgmt.automation.models.DscReportResourceNavigation] + :ivar module_name: Gets or sets the module name of the resource. + :vartype module_name: str + :ivar module_version: Gets or sets the module version of the resource. + :vartype module_version: str + :ivar resource_name: Gets or sets the name of the resource. + :vartype resource_name: str + :ivar error: Gets or sets the error of the resource. + :vartype error: str + :ivar status: Gets or sets the status of the resource. + :vartype status: str + :ivar duration_in_seconds: Gets or sets the duration in seconds for the resource. + :vartype duration_in_seconds: float + :ivar start_date: Gets or sets the start date of the resource. + :vartype start_date: ~datetime.datetime + """ + + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ID of the resource.""" + source_info: Optional[str] = rest_field( + name="sourceInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the source info of the resource.""" + depends_on: Optional[list["_models.DscReportResourceNavigation"]] = rest_field( + name="dependsOn", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Resource Navigation values for resources the resource depends on.""" + module_name: Optional[str] = rest_field( + name="moduleName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the module name of the resource.""" + module_version: Optional[str] = rest_field( + name="moduleVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the module version of the resource.""" + resource_name: Optional[str] = rest_field( + name="resourceName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the name of the resource.""" + error: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the error of the resource.""" + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the status of the resource.""" + duration_in_seconds: Optional[float] = rest_field( + name="durationInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the duration in seconds for the resource.""" + start_date: Optional[datetime.datetime] = rest_field( + name="startDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the start date of the resource.""" + + @overload + def __init__( + self, + *, + resource_id: Optional[str] = None, + source_info: Optional[str] = None, + depends_on: Optional[list["_models.DscReportResourceNavigation"]] = None, + module_name: Optional[str] = None, + module_version: Optional[str] = None, + resource_name: Optional[str] = None, + error: Optional[str] = None, + status: Optional[str] = None, + duration_in_seconds: Optional[float] = None, + start_date: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DscReportResourceNavigation(_Model): + """Navigation for DSC Report Resource. + + :ivar resource_id: Gets or sets the ID of the resource to navigate to. + :vartype resource_id: str + """ + + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the ID of the resource to navigate to.""" + + @overload + def __init__( + self, + *, + resource_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EncryptionProperties(_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 + """ + + key_vault_properties: Optional["_models.KeyVaultProperties"] = rest_field( + name="keyVaultProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Key vault properties.""" + key_source: Optional[Union[str, "_models.EncryptionKeySourceType"]] = rest_field( + name="keySource", visibility=["read", "create", "update", "delete", "query"] + ) + """Encryption Key Source. Known values are: \"Microsoft.Automation\" and \"Microsoft.Keyvault\".""" + identity: Optional["_models.EncryptionPropertiesIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """User identity used for CMK.""" + + @overload + def __init__( + self, + *, + key_vault_properties: Optional["_models.KeyVaultProperties"] = None, + key_source: Optional[Union[str, "_models.EncryptionKeySourceType"]] = None, + identity: Optional["_models.EncryptionPropertiesIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EncryptionPropertiesIdentity(_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}'. + :vartype user_assigned_identity: any + """ + + user_assigned_identity: Optional[Any] = rest_field( + name="userAssignedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """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}'.""" + + @overload + def __init__( + self, + *, + user_assigned_identity: Optional[Any] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_Model): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.automation.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.automation.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.automation.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FieldDefinition(_Model): + """Definition of the connection fields. + + :ivar is_encrypted: Gets or sets the isEncrypted flag of the connection field definition. + :vartype is_encrypted: bool + :ivar is_optional: Gets or sets the isOptional flag of the connection field definition. + :vartype is_optional: bool + :ivar type: Gets or sets the type of the connection field definition. Required. + :vartype type: str + """ + + is_encrypted: Optional[bool] = rest_field( + name="isEncrypted", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the isEncrypted flag of the connection field definition.""" + is_optional: Optional[bool] = rest_field( + name="isOptional", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the isOptional flag of the connection field definition.""" + type: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the type of the connection field definition. Required.""" + + @overload + def __init__( + self, + *, + type: str, + is_encrypted: Optional[bool] = None, + is_optional: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GraphicalRunbookContent(_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 + """ + + raw_content: Optional["_models.RawGraphicalRunbookContent"] = rest_field( + name="rawContent", visibility=["read", "create", "update", "delete", "query"] + ) + """Raw graphical Runbook content.""" + graph_runbook_json: Optional[str] = rest_field( + name="graphRunbookJson", visibility=["read", "create", "update", "delete", "query"] + ) + """Graphical Runbook content as JSON.""" + + @overload + def __init__( + self, + *, + raw_content: Optional["_models.RawGraphicalRunbookContent"] = None, + graph_runbook_json: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HybridRunbookWorker(TrackedResource): + """Definition of hybrid runbook worker. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Gets or sets the hybrid worker group properties. + :vartype properties: ~azure.mgmt.automation.models.HybridRunbookWorkerProperties + """ + + properties: Optional["_models.HybridRunbookWorkerProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the hybrid worker group properties.""" + + __flattened_items = [ + "ip", + "registered_date_time", + "last_seen_date_time", + "vm_resource_id", + "worker_type", + "worker_name", + ] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.HybridRunbookWorkerProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class HybridRunbookWorkerCreateOrUpdateParameters(_Model): # pylint: disable=name-too-long + """The parameters supplied to the create or update hybrid runbook worker operation. + + :ivar vm_resource_id: Azure Resource Manager Id for a virtual machine. + :vartype vm_resource_id: str + """ + + vm_resource_id: Optional[str] = rest_field( + name="vmResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure Resource Manager Id for a virtual machine.""" + + @overload + def __init__( + self, + *, + vm_resource_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HybridRunbookWorkerCreateParameters(_Model): + """The parameters supplied to the create hybrid runbook worker operation. + + :ivar properties: Gets or sets hybrid runbook worker group create or update properties. + :vartype properties: ~azure.mgmt.automation.models.HybridRunbookWorkerCreateOrUpdateParameters + :ivar name: Gets or sets the name of the resource. + :vartype name: str + """ + + properties: Optional["_models.HybridRunbookWorkerCreateOrUpdateParameters"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets hybrid runbook worker group create or update properties.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the name of the resource.""" + + __flattened_items = ["vm_resource_id"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.HybridRunbookWorkerCreateOrUpdateParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class HybridRunbookWorkerGroup(TrackedResource): + """Definition of hybrid runbook worker group. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Gets or sets the hybrid worker group properties. + :vartype properties: ~azure.mgmt.automation.models.HybridRunbookWorkerGroupProperties + """ + + properties: Optional["_models.HybridRunbookWorkerGroupProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the hybrid worker group properties.""" + + __flattened_items = ["group_type", "credential"] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.HybridRunbookWorkerGroupProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class HybridRunbookWorkerGroupCreateOrUpdateParameters(_Model): # pylint: disable=name-too-long + """The parameters supplied to the create hybrid runbook worker group operation. + + :ivar properties: Gets or sets hybrid runbook worker group create or update properties. + :vartype properties: + ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateProperties + :ivar name: Gets or sets the name of the resource. + :vartype name: str + """ + + properties: Optional["_models.HybridRunbookWorkerGroupCreateOrUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets hybrid runbook worker group create or update properties.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the resource.""" + + __flattened_items = ["credential"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.HybridRunbookWorkerGroupCreateOrUpdateProperties"] = None, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class HybridRunbookWorkerGroupCreateOrUpdateProperties(_Model): # pylint: disable=name-too-long + """The hybrid runbook worker group properties. + + :ivar credential: Sets the credential of a worker group. + :vartype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty + """ + + credential: Optional["_models.RunAsCredentialAssociationProperty"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Sets the credential of a worker group.""" + + @overload + def __init__( + self, + *, + credential: Optional["_models.RunAsCredentialAssociationProperty"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HybridRunbookWorkerGroupProperties(_Model): + """Definition of hybrid runbook worker group property. + + :ivar group_type: Type of the HybridWorkerGroup. Known values are: "User" and "System". + :vartype group_type: str or ~azure.mgmt.automation.models.GroupTypeEnum + :ivar credential: Sets the credential of a worker group. + :vartype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty + """ + + group_type: Optional[Union[str, "_models.GroupTypeEnum"]] = rest_field( + name="groupType", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of the HybridWorkerGroup. Known values are: \"User\" and \"System\".""" + credential: Optional["_models.RunAsCredentialAssociationProperty"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Sets the credential of a worker group.""" + + @overload + def __init__( + self, + *, + group_type: Optional[Union[str, "_models.GroupTypeEnum"]] = None, + credential: Optional["_models.RunAsCredentialAssociationProperty"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HybridRunbookWorkerMoveParameters(_Model): + """Parameters supplied to move hybrid worker operation. + + :ivar hybrid_runbook_worker_group_name: Gets or sets the target hybrid runbook worker group. + :vartype hybrid_runbook_worker_group_name: str + """ + + hybrid_runbook_worker_group_name: Optional[str] = rest_field( + name="hybridRunbookWorkerGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the target hybrid runbook worker group.""" + + @overload + def __init__( + self, + *, + hybrid_runbook_worker_group_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HybridRunbookWorkerProperties(_Model): + """Definition of hybrid runbook worker property. + + :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 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 + """ + + ip: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the assigned machine IP address.""" + registered_date_time: Optional[datetime.datetime] = rest_field( + name="registeredDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the registration time of the worker machine.""" + last_seen_date_time: Optional[datetime.datetime] = rest_field( + name="lastSeenDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Last Heartbeat from the Worker.""" + vm_resource_id: Optional[str] = rest_field( + name="vmResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure Resource Manager Id for a virtual machine.""" + worker_type: Optional[Union[str, "_models.WorkerType"]] = rest_field( + name="workerType", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of the HybridWorker. Known values are: \"HybridV1\" and \"HybridV2\".""" + worker_name: Optional[str] = rest_field( + name="workerName", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of the HybridWorker.""" + + @overload + def __init__( + self, + *, + ip: Optional[str] = None, + registered_date_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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Identity(_Model): + """Identity for the resource. + + :ivar principal_id: The principal ID of resource identity. The value must be an UUID. + :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}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.automation.models.UserAssignedIdentitiesProperties] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of resource identity. The value must be an UUID.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant ID of resource.""" + type: Optional[Union[str, "_models.ResourceIdentityType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity type. Known values are: \"SystemAssigned\", \"UserAssigned\", \"SystemAssigned, + UserAssigned\", and \"None\".""" + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesProperties"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """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}'.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentitiesProperties"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Job(ProxyResource): + """Definition of the job. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: The properties of the job. + :vartype properties: ~azure.mgmt.automation.models.JobProperties + """ + + properties: Optional["_models.JobProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the job.""" + + __flattened_items = [ + "runbook", + "started_by", + "run_on", + "job_runtime_environment", + "job_id", + "creation_time", + "status", + "status_details", + "start_time", + "end_time", + "exception", + "last_modified_time", + "last_status_modified_time", + "parameters", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.JobProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class JobCollectionItem(ProxyResource): + """Job collection item properties. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Job properties. Required. + :vartype properties: ~azure.mgmt.automation.models.JobCollectionItemProperties + """ + + properties: "_models.JobCollectionItemProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Job properties. Required.""" + + __flattened_items = [ + "runbook", + "job_id", + "started_by", + "creation_time", + "status", + "start_time", + "end_time", + "last_modified_time", + "provisioning_state", + "job_runtime_environment", + "run_on", + ] + + @overload + def __init__( + self, + *, + properties: "_models.JobCollectionItemProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class JobCollectionItemProperties(_Model): + """Job collection item properties. + + :ivar runbook: The runbook association. + :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty + :ivar job_id: The id of the job. + :vartype job_id: str + :ivar started_by: Gets or sets the job started by. + :vartype started_by: str + :ivar creation_time: The creation time of the job. + :vartype creation_time: ~datetime.datetime + :ivar status: The status of the job. Known values are: "New", "Activating", "Running", + "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected", "Suspending", + "Stopping", "Resuming", and "Removing". + :vartype status: str or ~azure.mgmt.automation.models.JobStatus + :ivar start_time: The start time of the job. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the job. + :vartype end_time: ~datetime.datetime + :ivar last_modified_time: The last modified time of the job. + :vartype last_modified_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state of a resource. + :vartype provisioning_state: str + :ivar job_runtime_environment: Runtime Environment Property. + :vartype job_runtime_environment: ~azure.mgmt.automation.models.JobRuntimeEnvironment + :ivar run_on: Specifies the runOn group name where the job was executed. + :vartype run_on: str + """ + + runbook: Optional["_models.RunbookAssociationProperty"] = rest_field(visibility=["read"]) + """The runbook association.""" + job_id: Optional[str] = rest_field(name="jobId", visibility=["read"]) + """The id of the job.""" + started_by: Optional[str] = rest_field(name="startedBy", visibility=["read"]) + """Gets or sets the job started by.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """The creation time of the job.""" + status: Optional[Union[str, "_models.JobStatus"]] = rest_field(visibility=["read"]) + """The status of the job. Known values are: \"New\", \"Activating\", \"Running\", \"Completed\", + \"Failed\", \"Stopped\", \"Blocked\", \"Suspended\", \"Disconnected\", \"Suspending\", + \"Stopping\", \"Resuming\", and \"Removing\".""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """The start time of the job.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """The end time of the job.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read"], format="rfc3339" + ) + """The last modified time of the job.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state of a resource.""" + job_runtime_environment: Optional["_models.JobRuntimeEnvironment"] = rest_field( + name="jobRuntimeEnvironment", visibility=["read", "create", "update", "delete", "query"] + ) + """Runtime Environment Property.""" + run_on: Optional[str] = rest_field(name="runOn", visibility=["read", "create", "update", "delete", "query"]) + """Specifies the runOn group name where the job was executed.""" + + @overload + def __init__( + self, + *, + job_runtime_environment: Optional["_models.JobRuntimeEnvironment"] = None, + run_on: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class JobCreateParameters(_Model): + """The parameters supplied to the create job operation. + + :ivar properties: Gets or sets the list of job properties. Required. + :vartype properties: ~azure.mgmt.automation.models.JobCreateProperties + """ + + properties: "_models.JobCreateProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the list of job properties. Required.""" + + __flattened_items = ["runbook", "parameters", "run_on"] + + @overload + def __init__( + self, + *, + properties: "_models.JobCreateProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class JobCreateProperties(_Model): + """JobCreateProperties. + + :ivar runbook: Gets or sets the runbook. + :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty + :ivar parameters: Gets or sets the parameters of the job. + :vartype parameters: dict[str, str] + :ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be + executed. + :vartype run_on: str + """ + + runbook: Optional["_models.RunbookAssociationProperty"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the runbook.""" + parameters: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the parameters of the job.""" + run_on: Optional[str] = rest_field(name="runOn", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the runOn which specifies the group name where the job is to be executed.""" + + @overload + def __init__( + self, + *, + runbook: Optional["_models.RunbookAssociationProperty"] = None, + parameters: Optional[dict[str, str]] = None, + run_on: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class JobNavigation(_Model): + """Software update configuration machine run job navigation properties. + + :ivar id: Id of the job associated with the software update configuration run. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Id of the job associated with the software update configuration run.""" + + +class JobProperties(_Model): + """Definition of job properties. + + :ivar runbook: Gets or sets the runbook. + :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty + :ivar started_by: Gets or sets the job started by. + :vartype started_by: str + :ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be + executed. + :vartype run_on: str + :ivar job_runtime_environment: Runtime Environment Property. + :vartype job_runtime_environment: ~azure.mgmt.automation.models.JobRuntimeEnvironment + :ivar job_id: Gets or sets the id of the job. + :vartype job_id: str + :ivar creation_time: Gets or sets the creation time of the job. + :vartype creation_time: ~datetime.datetime + :ivar status: Gets or sets the status of the job. Known values are: "New", "Activating", + "Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected", + "Suspending", "Stopping", "Resuming", and "Removing". + :vartype status: str or ~azure.mgmt.automation.models.JobStatus + :ivar status_details: Gets or sets the status details of the job. + :vartype status_details: str + :ivar start_time: Gets or sets the start time of the job. + :vartype start_time: ~datetime.datetime + :ivar end_time: Gets or sets the end time of the job. + :vartype end_time: ~datetime.datetime + :ivar exception: Gets or sets the exception of the job. + :vartype exception: str + :ivar last_modified_time: Gets or sets the last modified time of the job. + :vartype last_modified_time: ~datetime.datetime + :ivar last_status_modified_time: Gets or sets the last status modified time of the job. + :vartype last_status_modified_time: ~datetime.datetime + :ivar parameters: Gets or sets the parameters of the job. + :vartype parameters: dict[str, str] + :ivar provisioning_state: The current provisioning state of the job. Known values are: + "Failed", "Succeeded", "Suspended", and "Processing". + :vartype provisioning_state: str or ~azure.mgmt.automation.models.JobProvisioningState + """ + + runbook: Optional["_models.RunbookAssociationProperty"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the runbook.""" + started_by: Optional[str] = rest_field(name="startedBy", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the job started by.""" + run_on: Optional[str] = rest_field(name="runOn", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the runOn which specifies the group name where the job is to be executed.""" + job_runtime_environment: Optional["_models.JobRuntimeEnvironment"] = rest_field( + name="jobRuntimeEnvironment", visibility=["read", "create", "update", "delete", "query"] + ) + """Runtime Environment Property.""" + job_id: Optional[str] = rest_field(name="jobId", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the id of the job.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the creation time of the job.""" + status: Optional[Union[str, "_models.JobStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the status of the job. Known values are: \"New\", \"Activating\", \"Running\", + \"Completed\", \"Failed\", \"Stopped\", \"Blocked\", \"Suspended\", \"Disconnected\", + \"Suspending\", \"Stopping\", \"Resuming\", and \"Removing\".""" + status_details: Optional[str] = rest_field( + name="statusDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the status details of the job.""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the start time of the job.""" + end_time: Optional[datetime.datetime] = rest_field( + name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the end time of the job.""" + exception: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the exception of the job.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time of the job.""" + last_status_modified_time: Optional[datetime.datetime] = rest_field( + name="lastStatusModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last status modified time of the job.""" + parameters: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the parameters of the job.""" + provisioning_state: Optional[Union[str, "_models.JobProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The current provisioning state of the job. Known values are: \"Failed\", \"Succeeded\", + \"Suspended\", and \"Processing\".""" + + @overload + def __init__( + self, + *, + runbook: Optional["_models.RunbookAssociationProperty"] = None, + started_by: Optional[str] = None, + run_on: Optional[str] = None, + job_runtime_environment: Optional["_models.JobRuntimeEnvironment"] = None, + job_id: Optional[str] = None, + creation_time: Optional[datetime.datetime] = None, + status: Optional[Union[str, "_models.JobStatus"]] = None, + status_details: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class JobRuntimeEnvironment(_Model): + """The runbook property associated with the entity. + + :ivar runtime_environment_name: Name of Runtime Environment. + :vartype runtime_environment_name: str + """ + + runtime_environment_name: Optional[str] = rest_field( + name="runtimeEnvironmentName", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of Runtime Environment.""" + + @overload + def __init__( + self, + *, + runtime_environment_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class JobSchedule(ProxyResource): + """Definition of the job schedule. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Gets or sets the properties of the job schedule. + :vartype properties: ~azure.mgmt.automation.models.JobScheduleProperties + """ + + properties: Optional["_models.JobScheduleProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the job schedule.""" + + __flattened_items = ["job_schedule_id", "schedule", "runbook", "run_on", "parameters"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.JobScheduleProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class JobScheduleCreateParameters(_Model): + """The parameters supplied to the create job schedule operation. + + :ivar properties: Gets or sets the list of job schedule properties. Required. + :vartype properties: ~azure.mgmt.automation.models.JobScheduleCreateProperties + """ + + properties: "_models.JobScheduleCreateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of job schedule properties. Required.""" + + __flattened_items = ["schedule", "runbook", "run_on", "parameters"] + + @overload + def __init__( + self, + *, + properties: "_models.JobScheduleCreateProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class JobScheduleCreateProperties(_Model): + """The parameters supplied to the create job schedule operation. + + :ivar schedule: Gets or sets the schedule. Required. + :vartype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty + :ivar runbook: Gets or sets the runbook. Required. + :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty + :ivar run_on: Gets or sets the hybrid worker group that the scheduled job should run on. + :vartype run_on: str + :ivar parameters: Gets or sets a list of job properties. + :vartype parameters: dict[str, str] + """ + + schedule: "_models.ScheduleAssociationProperty" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the schedule. Required.""" + runbook: "_models.RunbookAssociationProperty" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the runbook. Required.""" + run_on: Optional[str] = rest_field(name="runOn", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the hybrid worker group that the scheduled job should run on.""" + parameters: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets a list of job properties.""" + + @overload + def __init__( + self, + *, + schedule: "_models.ScheduleAssociationProperty", + runbook: "_models.RunbookAssociationProperty", + run_on: Optional[str] = None, + parameters: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class JobScheduleProperties(_Model): + """Definition of job schedule parameters. + + :ivar job_schedule_id: Gets or sets the id of job schedule. + :vartype job_schedule_id: str + :ivar schedule: Gets or sets the schedule. + :vartype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty + :ivar runbook: Gets or sets the runbook. + :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty + :ivar run_on: Gets or sets the hybrid worker group that the scheduled job should run on. + :vartype run_on: str + :ivar parameters: Gets or sets the parameters of the job schedule. + :vartype parameters: dict[str, str] + """ + + job_schedule_id: Optional[str] = rest_field( + name="jobScheduleId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the id of job schedule.""" + schedule: Optional["_models.ScheduleAssociationProperty"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the schedule.""" + runbook: Optional["_models.RunbookAssociationProperty"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the runbook.""" + run_on: Optional[str] = rest_field(name="runOn", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the hybrid worker group that the scheduled job should run on.""" + parameters: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the parameters of the job schedule.""" + + @overload + def __init__( + self, + *, + job_schedule_id: Optional[str] = None, + schedule: Optional["_models.ScheduleAssociationProperty"] = None, + runbook: Optional["_models.RunbookAssociationProperty"] = None, + run_on: Optional[str] = None, + parameters: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class JobStream(_Model): + """Definition of the job stream. + + :ivar id: Gets or sets the id of the resource. + :vartype id: str + :ivar properties: Gets or sets the id of the job stream. + :vartype properties: ~azure.mgmt.automation.models.JobStreamProperties + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the id of the resource.""" + properties: Optional["_models.JobStreamProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the id of the job stream.""" + + __flattened_items = ["job_stream_id", "time", "stream_type", "stream_text", "summary", "value"] + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + properties: Optional["_models.JobStreamProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class JobStreamProperties(_Model): + """Definition of the job stream. + + :ivar job_stream_id: Gets or sets the id of the job stream. + :vartype job_stream_id: str + :ivar time: Gets or sets the creation time of the job. + :vartype time: ~datetime.datetime + :ivar stream_type: Gets or sets the stream type. Known values are: "Progress", "Output", + "Warning", "Error", "Debug", "Verbose", and "Any". + :vartype stream_type: str or ~azure.mgmt.automation.models.JobStreamType + :ivar stream_text: Gets or sets the stream text. + :vartype stream_text: str + :ivar summary: Gets or sets the summary. + :vartype summary: str + :ivar value: Gets or sets the values of the job stream. + :vartype value: dict[str, any] + """ + + job_stream_id: Optional[str] = rest_field( + name="jobStreamId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the id of the job stream.""" + time: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the creation time of the job.""" + stream_type: Optional[Union[str, "_models.JobStreamType"]] = rest_field( + name="streamType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the stream type. Known values are: \"Progress\", \"Output\", \"Warning\", + \"Error\", \"Debug\", \"Verbose\", and \"Any\".""" + stream_text: Optional[str] = rest_field( + name="streamText", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the stream text.""" + summary: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the summary.""" + value: Optional[dict[str, Any]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the values of the job stream.""" + + @overload + def __init__( + self, + *, + job_stream_id: Optional[str] = None, + time: Optional[datetime.datetime] = None, + stream_type: Optional[Union[str, "_models.JobStreamType"]] = None, + stream_text: Optional[str] = None, + summary: Optional[str] = None, + value: Optional[dict[str, Any]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Key(_Model): + """Automation key which is used to register a DSC Node. + + :ivar key_name: Automation key name. Known values are: "Primary" and "Secondary". + :vartype key_name: str or ~azure.mgmt.automation.models.AutomationKeyName + :ivar permissions: Automation key permissions. Known values are: "Read" and "Full". + :vartype permissions: str or ~azure.mgmt.automation.models.AutomationKeyPermissions + :ivar value: Value of the Automation Key used for registration. + :vartype value: str + """ + + key_name: Optional[Union[str, "_models.AutomationKeyName"]] = rest_field(name="KeyName", visibility=["read"]) + """Automation key name. Known values are: \"Primary\" and \"Secondary\".""" + permissions: Optional[Union[str, "_models.AutomationKeyPermissions"]] = rest_field( + name="Permissions", visibility=["read"] + ) + """Automation key permissions. Known values are: \"Read\" and \"Full\".""" + value: Optional[str] = rest_field(name="Value", visibility=["read"]) + """Value of the Automation Key used for registration.""" + + +class KeyListResult(_Model): + """KeyListResult. + + :ivar keys_property: Lists the automation keys. + :vartype keys_property: list[~azure.mgmt.automation.models.Key] + """ + + keys_property: Optional[list["_models.Key"]] = rest_field( + name="keys", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="keys" + ) + """Lists the automation keys.""" + + @overload + def __init__( + self, + *, + keys_property: Optional[list["_models.Key"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultProperties(_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 + """ + + keyvault_uri: Optional[str] = rest_field( + name="keyvaultUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The URI of the key vault key used to encrypt data.""" + key_name: Optional[str] = rest_field(name="keyName", visibility=["read", "create", "update", "delete", "query"]) + """The name of key used to encrypt data.""" + key_version: Optional[str] = rest_field( + name="keyVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The key version of the key used to encrypt data.""" + + @overload + def __init__( + self, + *, + keyvault_uri: Optional[str] = None, + key_name: Optional[str] = None, + key_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LinkedWorkspace(_Model): + """Definition of the linked workspace. + + :ivar id: Gets the id of the linked workspace. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Gets the id of the linked workspace.""" + + +class LinuxProperties(_Model): + """Linux specific update configuration. + + :ivar included_package_classifications: Update classifications included in the software update + configuration. Known values are: "Unclassified", "Critical", "Security", and "Other". + :vartype included_package_classifications: str or + ~azure.mgmt.automation.models.LinuxUpdateClasses + :ivar excluded_package_name_masks: packages excluded from the software update configuration. + :vartype excluded_package_name_masks: list[str] + :ivar included_package_name_masks: packages included from the software update configuration. + :vartype included_package_name_masks: list[str] + :ivar reboot_setting: Reboot setting for the software update configuration. + :vartype reboot_setting: str + """ + + included_package_classifications: Optional[Union[str, "_models.LinuxUpdateClasses"]] = rest_field( + name="includedPackageClassifications", visibility=["read", "create", "update", "delete", "query"] + ) + """Update classifications included in the software update configuration. Known values are: + \"Unclassified\", \"Critical\", \"Security\", and \"Other\".""" + excluded_package_name_masks: Optional[list[str]] = rest_field( + name="excludedPackageNameMasks", visibility=["read", "create", "update", "delete", "query"] + ) + """packages excluded from the software update configuration.""" + included_package_name_masks: Optional[list[str]] = rest_field( + name="includedPackageNameMasks", visibility=["read", "create", "update", "delete", "query"] + ) + """packages included from the software update configuration.""" + reboot_setting: Optional[str] = rest_field( + name="rebootSetting", visibility=["read", "create", "update", "delete", "query"] + ) + """Reboot setting for the software update configuration.""" + + @overload + 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, + reboot_setting: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LogSpecification(_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 + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the specification.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """The display name of the specification.""" + blob_duration: Optional[str] = rest_field( + name="blobDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """Duration of the blob.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MetricSpecification(_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] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the metric.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """The display name of the metric.""" + display_description: Optional[str] = rest_field( + name="displayDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The description of the metric.""" + unit: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Units the metric to be displayed in.""" + aggregation_type: Optional[str] = rest_field( + name="aggregationType", visibility=["read", "create", "update", "delete", "query"] + ) + """The aggregation type.""" + dimensions: Optional[list["_models.Dimension"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """List of dimensions.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Module(TrackedResource): + """Definition of the module type. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Gets or sets the module properties. + :vartype properties: ~azure.mgmt.automation.models.ModuleProperties + :ivar etag: Gets or sets the etag of the resource. + :vartype etag: str + """ + + properties: Optional["_models.ModuleProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the module properties.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the etag of the resource.""" + + __flattened_items = [ + "is_global", + "version", + "size_in_bytes", + "activity_count", + "provisioning_state", + "content_link", + "error", + "creation_time", + "last_modified_time", + "description", + "is_composite", + ] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.ModuleProperties"] = None, + etag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ModuleCreateOrUpdateParameters(_Model): + """The parameters supplied to the create or update module operation. + + :ivar properties: Gets or sets the module create properties. Required. + :vartype properties: ~azure.mgmt.automation.models.ModuleCreateOrUpdateProperties + :ivar name: Gets or sets name of the resource. + :vartype name: str + :ivar location: Gets or sets the location of the resource. + :vartype location: str + :ivar tags: Gets or sets the tags attached to the resource. + :vartype tags: dict[str, str] + """ + + properties: "_models.ModuleCreateOrUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the module create properties. Required.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets name of the resource.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the location of the resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the tags attached to the resource.""" + + __flattened_items = ["content_link"] + + @overload + def __init__( + self, + *, + properties: "_models.ModuleCreateOrUpdateProperties", + name: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ModuleCreateOrUpdateProperties(_Model): + """The parameters supplied to the create or update module properties. + + :ivar content_link: Gets or sets the module content link. Required. + :vartype content_link: ~azure.mgmt.automation.models.ContentLink + """ + + content_link: "_models.ContentLink" = rest_field( + name="contentLink", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the module content link. Required.""" + + @overload + def __init__( + self, + *, + content_link: "_models.ContentLink", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModuleErrorInfo(_Model): + """Definition of the module error info type. + + :ivar code: Gets or sets the error code. + :vartype code: str + :ivar message: Gets or sets the error message. + :vartype message: str + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the error code.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the error message.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModuleProperties(_Model): + """Definition of the module property type. + + :ivar is_global: Gets or sets the isGlobal flag of the module. + :vartype is_global: bool + :ivar version: Gets or sets the version of the module. + :vartype version: str + :ivar size_in_bytes: Gets or sets the size in bytes of the module. + :vartype size_in_bytes: int + :ivar activity_count: Gets or sets the activity count of the module. + :vartype activity_count: int + :ivar provisioning_state: Gets or sets the provisioning state of the module. Known values are: + "Created", "Creating", "StartingImportModuleRunbook", "RunningImportModuleRunbook", + "ContentRetrieved", "ContentDownloaded", "ContentValidated", "ConnectionTypeImported", + "ContentStored", "ModuleDataStored", "ActivitiesStored", "ModuleImportRunbookComplete", + "Succeeded", "Failed", "Canceled", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.automation.models.ModuleProvisioningState + :ivar content_link: Gets or sets the contentLink of the module. + :vartype content_link: ~azure.mgmt.automation.models.ContentLink + :ivar error: Gets or sets the error info of the module. + :vartype error: ~azure.mgmt.automation.models.ModuleErrorInfo + :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 + :ivar is_composite: Gets or sets type of module, if its composite or not. + :vartype is_composite: bool + """ + + is_global: Optional[bool] = rest_field(name="isGlobal", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the isGlobal flag of the module.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the version of the module.""" + size_in_bytes: Optional[int] = rest_field( + name="sizeInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the size in bytes of the module.""" + activity_count: Optional[int] = rest_field( + name="activityCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the activity count of the module.""" + provisioning_state: Optional[Union[str, "_models.ModuleProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the provisioning state of the module. Known values are: \"Created\", \"Creating\", + \"StartingImportModuleRunbook\", \"RunningImportModuleRunbook\", \"ContentRetrieved\", + \"ContentDownloaded\", \"ContentValidated\", \"ConnectionTypeImported\", \"ContentStored\", + \"ModuleDataStored\", \"ActivitiesStored\", \"ModuleImportRunbookComplete\", \"Succeeded\", + \"Failed\", \"Canceled\", and \"Updating\".""" + content_link: Optional["_models.ContentLink"] = rest_field( + name="contentLink", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the contentLink of the module.""" + error: Optional["_models.ModuleErrorInfo"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the error info of the module.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + is_composite: Optional[bool] = rest_field( + name="isComposite", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets type of module, if its composite or not.""" + + @overload + def __init__( + self, + *, + is_global: Optional[bool] = None, + version: Optional[str] = None, + size_in_bytes: Optional[int] = None, + activity_count: Optional[int] = None, + provisioning_state: Optional[Union[str, "_models.ModuleProvisioningState"]] = None, + content_link: Optional["_models.ContentLink"] = None, + error: Optional["_models.ModuleErrorInfo"] = None, + creation_time: Optional[datetime.datetime] = None, + last_modified_time: Optional[datetime.datetime] = None, + description: Optional[str] = None, + is_composite: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModuleUpdateParameters(_Model): + """The parameters supplied to the update module operation. + + :ivar properties: Gets or sets the module update properties. + :vartype properties: ~azure.mgmt.automation.models.ModuleUpdateProperties + :ivar name: Gets or sets name of the resource. + :vartype name: str + :ivar location: Gets or sets the location of the resource. + :vartype location: str + :ivar tags: Gets or sets the tags attached to the resource. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.ModuleUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the module update properties.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets name of the resource.""" + location: Optional[str] = rest_field(visibility=["read"]) + """Gets or sets the location of the resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the tags attached to the resource.""" + + __flattened_items = ["content_link"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ModuleUpdateProperties"] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ModuleUpdateProperties(_Model): + """The parameters supplied to the update properties. + + :ivar content_link: Gets or sets the module content link. + :vartype content_link: ~azure.mgmt.automation.models.ContentLink + """ + + content_link: Optional["_models.ContentLink"] = rest_field( + name="contentLink", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the module content link.""" + + @overload + def __init__( + self, + *, + content_link: Optional["_models.ContentLink"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NodeCount(_Model): + """Number of nodes based on the Filter. + + :ivar name: Gets the name of a count type. + :vartype name: str + :ivar properties: + :vartype properties: ~azure.mgmt.automation.models.NodeCountProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets the name of a count type.""" + properties: Optional["_models.NodeCountProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.NodeCountProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NodeCountProperties(_Model): + """NodeCountProperties. + + :ivar count: Gets the count for the name. + :vartype count: int + """ + + count: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets the count for the name.""" + + @overload + def __init__( + self, + *, + count: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NodeCounts(_Model): + """Gets the count of nodes by count type. + + :ivar value: Gets an array of counts. + :vartype value: list[~azure.mgmt.automation.models.NodeCount] + :ivar total_count: Gets the total number of records matching countType criteria. + :vartype total_count: int + """ + + value: Optional[list["_models.NodeCount"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets an array of counts.""" + total_count: Optional[int] = rest_field( + name="totalCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the total number of records matching countType criteria.""" + + @overload + def __init__( + self, + *, + value: Optional[list["_models.NodeCount"]] = None, + total_count: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NonAzureQueryProperties(_Model): + """Non Azure query for the update configuration. + + :ivar function_alias: Log Analytics Saved Search name. + :vartype function_alias: str + :ivar workspace_id: Workspace Id for Log Analytics in which the saved Search is resided. + :vartype workspace_id: str + """ + + function_alias: Optional[str] = rest_field( + name="functionAlias", visibility=["read", "create", "update", "delete", "query"] + ) + """Log Analytics Saved Search name.""" + workspace_id: Optional[str] = rest_field( + name="workspaceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Workspace Id for Log Analytics in which the saved Search is resided.""" + + @overload + def __init__( + self, + *, + function_alias: Optional[str] = None, + workspace_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Operation(_Model): + """Automation REST API operation. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :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 properties: Operation properties format. + :vartype properties: ~azure.mgmt.automation.models.OperationPropertiesFormat + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation name: {provider}/{resource}/{operation}.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Provider, Resource and Operation values.""" + origin: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Origin of the operation.""" + properties: Optional["_models.OperationPropertiesFormat"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Operation properties format.""" + + __flattened_items = ["service_specification"] + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["_models.OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["_models.OperationPropertiesFormat"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class OperationDisplay(_Model): + """Provider, Resource and Operation values. + + :ivar provider: Service provider: Microsoft.Automation. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Runbooks, Jobs etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Service provider: Microsoft.Automation.""" + resource: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource on which the operation is performed: Runbooks, Jobs etc.""" + operation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation type: Read, write, delete, etc.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Description of the operation.""" + + @overload + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationPropertiesFormat(_Model): + """Description of operation properties format. + + :ivar service_specification: Specification of the service. + :vartype service_specification: + ~azure.mgmt.automation.models.OperationPropertiesFormatServiceSpecification + """ + + service_specification: Optional["_models.OperationPropertiesFormatServiceSpecification"] = rest_field( + name="serviceSpecification", visibility=["read", "create", "update", "delete", "query"] + ) + """Specification of the service.""" + + @overload + def __init__( + self, + *, + service_specification: Optional["_models.OperationPropertiesFormatServiceSpecification"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationPropertiesFormatServiceSpecification(_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] + """ + + metric_specifications: Optional[list["_models.MetricSpecification"]] = rest_field( + name="metricSpecifications", visibility=["read", "create", "update", "delete", "query"] + ) + """Operation service specification.""" + log_specifications: Optional[list["_models.LogSpecification"]] = rest_field( + name="logSpecifications", visibility=["read", "create", "update", "delete", "query"] + ) + """Operation log specification.""" + + @overload + def __init__( + self, + *, + metric_specifications: Optional[list["_models.MetricSpecification"]] = None, + log_specifications: Optional[list["_models.LogSpecification"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Package(TrackedResource): + """Definition of the Package type. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Gets or sets the Package properties. + :vartype properties: ~azure.mgmt.automation.models.PackageProperties + """ + + properties: Optional["_models.PackageProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Package properties.""" + + __flattened_items = ["default", "version", "size_in_bytes", "provisioning_state", "content_link", "error", "all_of"] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.PackageProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PackageCreateOrUpdateParameters(_Model): + """The parameters supplied to the create or update package operation. + + :ivar properties: Gets or sets the package create properties. Required. + :vartype properties: ~azure.mgmt.automation.models.PackageCreateOrUpdateProperties + :ivar all_of: The resource model definition for an Azure Resource Manager tracked top level + resource which has 'tags' and a 'location'. + :vartype all_of: ~azure.mgmt.automation.models.TrackedResource + """ + + properties: "_models.PackageCreateOrUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the package create properties. Required.""" + all_of: Optional["_models.TrackedResource"] = rest_field( + name="allOf", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'.""" + + __flattened_items = ["content_link"] + + @overload + def __init__( + self, + *, + properties: "_models.PackageCreateOrUpdateProperties", + all_of: Optional["_models.TrackedResource"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PackageCreateOrUpdateProperties(_Model): + """The parameters supplied to the create or update package properties. + + :ivar content_link: Gets or sets the package content link. Required. + :vartype content_link: ~azure.mgmt.automation.models.ContentLink + """ + + content_link: "_models.ContentLink" = rest_field( + name="contentLink", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the package content link. Required.""" + + @overload + def __init__( + self, + *, + content_link: "_models.ContentLink", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PackageErrorInfo(_Model): + """Definition of the package error info type. + + :ivar code: Package import error code. + :vartype code: str + :ivar message: Package import error message. + :vartype message: str + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Package import error code.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Package import error message.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PackageProperties(_Model): + """Definition of the package property type. + + :ivar default: Gets or sets the isGlobal flag of the package. + :vartype default: bool + :ivar version: Gets or sets the version of the Package. + :vartype version: str + :ivar size_in_bytes: Gets or sets the size in bytes of the Package. + :vartype size_in_bytes: int + :ivar provisioning_state: Gets or sets the provisioning state of the Package. Known values are: + "Created", "Creating", "StartingImportModuleRunbook", "RunningImportModuleRunbook", + "ContentRetrieved", "ContentDownloaded", "ContentValidated", "ConnectionTypeImported", + "ContentStored", "ModuleDataStored", "ActivitiesStored", "ModuleImportRunbookComplete", + "Succeeded", "Failed", "Canceled", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.automation.models.PackageProvisioningState + :ivar content_link: Gets or sets the contentLink of the Package. + :vartype content_link: ~azure.mgmt.automation.models.ContentLink + :ivar error: Gets or sets the error info of the Package. + :vartype error: ~azure.mgmt.automation.models.PackageErrorInfo + :ivar all_of: Metadata pertaining to creation and last modification of the resource. + :vartype all_of: ~azure.mgmt.automation.models.SystemData + """ + + default: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the isGlobal flag of the package.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the version of the Package.""" + size_in_bytes: Optional[int] = rest_field( + name="sizeInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the size in bytes of the Package.""" + provisioning_state: Optional[Union[str, "_models.PackageProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Gets or sets the provisioning state of the Package. Known values are: \"Created\", + \"Creating\", \"StartingImportModuleRunbook\", \"RunningImportModuleRunbook\", + \"ContentRetrieved\", \"ContentDownloaded\", \"ContentValidated\", \"ConnectionTypeImported\", + \"ContentStored\", \"ModuleDataStored\", \"ActivitiesStored\", \"ModuleImportRunbookComplete\", + \"Succeeded\", \"Failed\", \"Canceled\", and \"Updating\".""" + content_link: Optional["_models.ContentLink"] = rest_field( + name="contentLink", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the contentLink of the Package.""" + error: Optional["_models.PackageErrorInfo"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the error info of the Package.""" + all_of: Optional["_models.SystemData"] = rest_field( + name="allOf", visibility=["read", "create", "update", "delete", "query"] + ) + """Metadata pertaining to creation and last modification of the resource.""" + + @overload + def __init__( + self, + *, + default: Optional[bool] = None, + version: Optional[str] = None, + size_in_bytes: Optional[int] = None, + content_link: Optional["_models.ContentLink"] = None, + error: Optional["_models.PackageErrorInfo"] = None, + all_of: Optional["_models.SystemData"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PackageUpdateParameters(_Model): + """The parameters supplied to the update package operation. + + :ivar properties: Gets or sets the package update properties. + :vartype properties: ~azure.mgmt.automation.models.PackageUpdateProperties + :ivar all_of: The resource model definition for an Azure Resource Manager tracked top level + resource which has 'tags' and a 'location'. + :vartype all_of: ~azure.mgmt.automation.models.TrackedResource + """ + + properties: Optional["_models.PackageUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the package update properties.""" + all_of: Optional["_models.TrackedResource"] = rest_field( + name="allOf", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'.""" + + __flattened_items = ["content_link"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.PackageUpdateProperties"] = None, + all_of: Optional["_models.TrackedResource"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PackageUpdateProperties(_Model): + """The parameters supplied to the update properties. + + :ivar content_link: Gets or sets the package content link. + :vartype content_link: ~azure.mgmt.automation.models.ContentLink + """ + + content_link: Optional["_models.ContentLink"] = rest_field( + name="contentLink", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the package content link.""" + + @overload + def __init__( + self, + *, + content_link: Optional["_models.ContentLink"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpointConnection(ProxyResource): + """A private endpoint connection. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.automation.models.PrivateEndpointConnectionProperties + """ + + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + + __flattened_items = ["private_endpoint", "group_ids", "private_link_service_connection_state"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PrivateEndpointConnectionProperties(_Model): + """Properties of a private endpoint connection. + + :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 + """ + + private_endpoint: Optional["_models.PrivateEndpointProperty"] = rest_field( + name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Private endpoint which the connection belongs to.""" + group_ids: Optional[list[str]] = rest_field( + name="groupIds", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the groupIds.""" + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = rest_field( + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """Connection State of the Private Endpoint Connection.""" + + @overload + def __init__( + self, + *, + private_endpoint: Optional["_models.PrivateEndpointProperty"] = None, + group_ids: Optional[list[str]] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpointProperty(_Model): + """Private endpoint which the connection belongs to. + + :ivar id: Resource id of the private endpoint. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource id of the private endpoint.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResource(ProxyResource): + """A private link resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.automation.models.PrivateLinkResourceProperties + """ + + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + + __flattened_items = ["group_id", "required_members"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateLinkResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PrivateLinkResourceProperties(_Model): + """Properties of a private link resource. + + :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] + """ + + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """The private link resource group id.""" + required_members: Optional[list[str]] = rest_field(name="requiredMembers", visibility=["read"]) + """The private link resource required member names.""" + + +class PrivateLinkServiceConnectionStateProperty(_Model): # pylint: disable=name-too-long + """Connection State of the Private Endpoint Connection. + + :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 + """ + + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The private link service connection status.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The private link service connection description.""" + actions_required: Optional[str] = rest_field(name="actionsRequired", visibility=["read"]) + """Any action that is required beyond basic workflow (approve/ reject/ disconnect).""" + + @overload + def __init__( + self, + *, + status: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PythonPackageCreateParameters(_Model): + """The parameters supplied to the create or update module operation. + + :ivar properties: Gets or sets the module create properties. Required. + :vartype properties: ~azure.mgmt.automation.models.PythonPackageCreateProperties + :ivar tags: Gets or sets the tags attached to the resource. + :vartype tags: dict[str, str] + """ + + properties: "_models.PythonPackageCreateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the module create properties. Required.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the tags attached to the resource.""" + + __flattened_items = ["content_link"] + + @overload + def __init__( + self, + *, + properties: "_models.PythonPackageCreateProperties", + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PythonPackageCreateProperties(_Model): + """The parameters supplied to the create or update module properties. + + :ivar content_link: Gets or sets the module content link. Required. + :vartype content_link: ~azure.mgmt.automation.models.ContentLink + """ + + content_link: "_models.ContentLink" = rest_field( + name="contentLink", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the module content link. Required.""" + + @overload + def __init__( + self, + *, + content_link: "_models.ContentLink", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PythonPackageUpdateParameters(_Model): + """The parameters supplied to the update module operation. + + :ivar tags: Gets or sets the tags attached to the resource. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the tags attached to the resource.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RawGraphicalRunbookContent(_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 + """ + + schema_version: Optional[str] = rest_field( + name="schemaVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Schema version of the serializer.""" + runbook_definition: Optional[str] = rest_field( + name="runbookDefinition", visibility=["read", "create", "update", "delete", "query"] + ) + """Serialized Graphical runbook.""" + runbook_type: Optional[Union[str, "_models.GraphRunbookType"]] = rest_field( + name="runbookType", visibility=["read", "create", "update", "delete", "query"] + ) + """Runbook Type. Known values are: \"GraphPowerShell\" and \"GraphPowerShellWorkflow\".""" + + @overload + def __init__( + self, + *, + schema_version: Optional[str] = None, + runbook_definition: Optional[str] = None, + runbook_type: Optional[Union[str, "_models.GraphRunbookType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RunAsCredentialAssociationProperty(_Model): + """Definition of RunAs credential to use for hybrid worker. + + :ivar name: Gets or sets the name of the credential. + :vartype name: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the credential.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Runbook(TrackedResource): + """Definition of the runbook type. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Gets or sets the runbook properties. + :vartype properties: ~azure.mgmt.automation.models.RunbookProperties + :ivar etag: Gets or sets the etag of the resource. + :vartype etag: str + """ + + properties: Optional["_models.RunbookProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the runbook properties.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the etag of the resource.""" + + __flattened_items = [ + "runtime_environment", + "runbook_type", + "publish_content_link", + "state", + "log_verbose", + "log_progress", + "log_activity_trace", + "job_count", + "parameters", + "output_types", + "draft", + "provisioning_state", + "last_modified_by", + "creation_time", + "last_modified_time", + "description", + ] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.RunbookProperties"] = None, + etag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class RunbookAssociationProperty(_Model): + """The runbook property associated with the entity. + + :ivar name: Gets or sets the name of the runbook. + :vartype name: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the runbook.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RunbookCreateOrUpdateParameters(_Model): + """The parameters supplied to the create or update runbook operation. + + :ivar properties: Gets or sets runbook create or update properties. Required. + :vartype properties: ~azure.mgmt.automation.models.RunbookCreateOrUpdateProperties + :ivar name: Gets or sets the name of the resource. + :vartype name: str + :ivar location: Gets or sets the location of the resource. + :vartype location: str + :ivar tags: Gets or sets the tags attached to the resource. + :vartype tags: dict[str, str] + """ + + properties: "_models.RunbookCreateOrUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets runbook create or update properties. Required.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the resource.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the location of the resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the tags attached to the resource.""" + + __flattened_items = [ + "log_verbose", + "log_progress", + "runtime_environment", + "runbook_type", + "draft", + "publish_content_link", + "description", + "log_activity_trace", + ] + + @overload + def __init__( + self, + *, + properties: "_models.RunbookCreateOrUpdateProperties", + name: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class RunbookCreateOrUpdateProperties(_Model): + """The parameters supplied to the create or update runbook properties. + + :ivar log_verbose: Gets or sets verbose log option. + :vartype log_verbose: bool + :ivar log_progress: Gets or sets progress log option. + :vartype log_progress: bool + :ivar runtime_environment: Environment of the runbook. + :vartype runtime_environment: str + :ivar runbook_type: Gets or sets the type of the runbook. Required. Known values are: "Script", + "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", + "Python2", "Python3", "Python", and "PowerShell72". + :vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum + :ivar draft: Gets or sets the draft runbook properties. + :vartype draft: ~azure.mgmt.automation.models.RunbookDraft + :ivar publish_content_link: Gets or sets the published runbook content link. + :vartype publish_content_link: ~azure.mgmt.automation.models.ContentLink + :ivar description: Gets or sets the description of the runbook. + :vartype description: str + :ivar log_activity_trace: Gets or sets the activity-level tracing options of the runbook. + :vartype log_activity_trace: int + """ + + log_verbose: Optional[bool] = rest_field( + name="logVerbose", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets verbose log option.""" + log_progress: Optional[bool] = rest_field( + name="logProgress", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets progress log option.""" + runtime_environment: Optional[str] = rest_field( + name="runtimeEnvironment", visibility=["read", "create", "update", "delete", "query"] + ) + """Environment of the runbook.""" + runbook_type: Union[str, "_models.RunbookTypeEnum"] = rest_field( + name="runbookType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the type of the runbook. Required. Known values are: \"Script\", \"Graph\", + \"PowerShellWorkflow\", \"PowerShell\", \"GraphPowerShellWorkflow\", \"GraphPowerShell\", + \"Python2\", \"Python3\", \"Python\", and \"PowerShell72\".""" + draft: Optional["_models.RunbookDraft"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the draft runbook properties.""" + publish_content_link: Optional["_models.ContentLink"] = rest_field( + name="publishContentLink", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the published runbook content link.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the runbook.""" + log_activity_trace: Optional[int] = rest_field( + name="logActivityTrace", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the activity-level tracing options of the runbook.""" + + @overload + def __init__( + self, + *, + runbook_type: Union[str, "_models.RunbookTypeEnum"], + log_verbose: Optional[bool] = None, + log_progress: Optional[bool] = None, + runtime_environment: Optional[str] = None, + draft: Optional["_models.RunbookDraft"] = None, + publish_content_link: Optional["_models.ContentLink"] = None, + description: Optional[str] = None, + log_activity_trace: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RunbookDraft(_Model): + """RunbookDraft. + + :ivar in_edit: Gets or sets whether runbook is in edit mode. + :vartype in_edit: bool + :ivar draft_content_link: Gets or sets the draft runbook content link. + :vartype draft_content_link: ~azure.mgmt.automation.models.ContentLink + :ivar creation_time: Gets or sets the creation time of the runbook draft. + :vartype creation_time: ~datetime.datetime + :ivar last_modified_time: Gets or sets the last modified time of the runbook draft. + :vartype last_modified_time: ~datetime.datetime + :ivar parameters: Gets or sets the runbook draft parameters. + :vartype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter] + :ivar output_types: Gets or sets the runbook output types. + :vartype output_types: list[str] + """ + + in_edit: Optional[bool] = rest_field(name="inEdit", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets whether runbook is in edit mode.""" + draft_content_link: Optional["_models.ContentLink"] = rest_field( + name="draftContentLink", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the draft runbook content link.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the creation time of the runbook draft.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time of the runbook draft.""" + parameters: Optional[dict[str, "_models.RunbookParameter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the runbook draft parameters.""" + output_types: Optional[list[str]] = rest_field( + name="outputTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the runbook output types.""" + + @overload + def __init__( + self, + *, + in_edit: Optional[bool] = None, + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RunbookDraftUndoEditResult(_Model): + """The response model for the undo edit runbook operation. + + :ivar status_code: Known values are: "Continue", "SwitchingProtocols", "OK", "Created", + "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", + "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", + "RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb", + "BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed", + "NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone", + "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", + "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", + "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", + and "HttpVersionNotSupported". + :vartype status_code: str or ~azure.mgmt.automation.models.HttpStatusCode + :ivar request_id: + :vartype request_id: str + """ + + status_code: Optional[Union[str, "_models.HttpStatusCode"]] = rest_field( + name="statusCode", visibility=["read", "create", "update", "delete", "query"] + ) + """Known values are: \"Continue\", \"SwitchingProtocols\", \"OK\", \"Created\", \"Accepted\", + \"NonAuthoritativeInformation\", \"NoContent\", \"ResetContent\", \"PartialContent\", + \"MultipleChoices\", \"Ambiguous\", \"MovedPermanently\", \"Moved\", \"Found\", \"Redirect\", + \"SeeOther\", \"RedirectMethod\", \"NotModified\", \"UseProxy\", \"Unused\", + \"TemporaryRedirect\", \"RedirectKeepVerb\", \"BadRequest\", \"Unauthorized\", + \"PaymentRequired\", \"Forbidden\", \"NotFound\", \"MethodNotAllowed\", \"NotAcceptable\", + \"ProxyAuthenticationRequired\", \"RequestTimeout\", \"Conflict\", \"Gone\", + \"LengthRequired\", \"PreconditionFailed\", \"RequestEntityTooLarge\", \"RequestUriTooLong\", + \"UnsupportedMediaType\", \"RequestedRangeNotSatisfiable\", \"ExpectationFailed\", + \"UpgradeRequired\", \"InternalServerError\", \"NotImplemented\", \"BadGateway\", + \"ServiceUnavailable\", \"GatewayTimeout\", and \"HttpVersionNotSupported\".""" + request_id: Optional[str] = rest_field(name="requestId", visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + status_code: Optional[Union[str, "_models.HttpStatusCode"]] = None, + request_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RunbookParameter(_Model): + """Definition of the runbook parameter type. + + :ivar type: Gets or sets the type of the parameter. + :vartype type: str + :ivar is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is mandatory + or not. + :vartype is_mandatory: bool + :ivar position: Get or sets the position of the parameter. + :vartype position: int + :ivar default_value: Gets or sets the default value of parameter. + :vartype default_value: str + """ + + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the type of the parameter.""" + is_mandatory: Optional[bool] = rest_field( + name="isMandatory", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a Boolean value to indicate whether the parameter is mandatory or not.""" + position: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Get or sets the position of the parameter.""" + default_value: Optional[str] = rest_field( + name="defaultValue", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the default value of parameter.""" + + @overload + def __init__( + self, + *, + type: Optional[str] = None, + is_mandatory: Optional[bool] = None, + position: Optional[int] = None, + default_value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RunbookProperties(_Model): + """Definition of the runbook property type. + + :ivar runtime_environment: Runtime Environment of the runbook execution. + :vartype runtime_environment: str + :ivar runbook_type: Gets or sets the type of the runbook. Known values are: "Script", "Graph", + "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", "Python2", + "Python3", "Python", and "PowerShell72". + :vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum + :ivar publish_content_link: Gets or sets the published runbook content link. + :vartype publish_content_link: ~azure.mgmt.automation.models.ContentLink + :ivar state: Gets or sets the state of the runbook. Known values are: "New", "Edit", and + "Published". + :vartype state: str or ~azure.mgmt.automation.models.RunbookState + :ivar log_verbose: Gets or sets verbose log option. + :vartype log_verbose: bool + :ivar log_progress: Gets or sets progress log option. + :vartype log_progress: bool + :ivar log_activity_trace: Gets or sets the option to log activity trace of the runbook. + :vartype log_activity_trace: int + :ivar job_count: Gets or sets the job count of the runbook. + :vartype job_count: int + :ivar parameters: Gets or sets the runbook parameters. + :vartype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter] + :ivar output_types: Gets or sets the runbook output types. + :vartype output_types: list[str] + :ivar draft: Gets or sets the draft runbook properties. + :vartype draft: ~azure.mgmt.automation.models.RunbookDraft + :ivar provisioning_state: Gets or sets the provisioning state of the runbook. Default value is + "Succeeded". + :vartype provisioning_state: str + :ivar last_modified_by: Gets or sets the last modified by. + :vartype last_modified_by: str + :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 + """ + + runtime_environment: Optional[str] = rest_field( + name="runtimeEnvironment", visibility=["read", "create", "update", "delete", "query"] + ) + """Runtime Environment of the runbook execution.""" + runbook_type: Optional[Union[str, "_models.RunbookTypeEnum"]] = rest_field( + name="runbookType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the type of the runbook. Known values are: \"Script\", \"Graph\", + \"PowerShellWorkflow\", \"PowerShell\", \"GraphPowerShellWorkflow\", \"GraphPowerShell\", + \"Python2\", \"Python3\", \"Python\", and \"PowerShell72\".""" + publish_content_link: Optional["_models.ContentLink"] = rest_field( + name="publishContentLink", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the published runbook content link.""" + state: Optional[Union[str, "_models.RunbookState"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the state of the runbook. Known values are: \"New\", \"Edit\", and \"Published\".""" + log_verbose: Optional[bool] = rest_field( + name="logVerbose", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets verbose log option.""" + log_progress: Optional[bool] = rest_field( + name="logProgress", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets progress log option.""" + log_activity_trace: Optional[int] = rest_field( + name="logActivityTrace", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the option to log activity trace of the runbook.""" + job_count: Optional[int] = rest_field(name="jobCount", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the job count of the runbook.""" + parameters: Optional[dict[str, "_models.RunbookParameter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the runbook parameters.""" + output_types: Optional[list[str]] = rest_field( + name="outputTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the runbook output types.""" + draft: Optional["_models.RunbookDraft"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the draft runbook properties.""" + provisioning_state: Optional[Literal["Succeeded"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the provisioning state of the runbook. Default value is \"Succeeded\".""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the last modified by.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + + @overload + def __init__( + self, + *, + runtime_environment: Optional[str] = None, + runbook_type: Optional[Union[str, "_models.RunbookTypeEnum"]] = None, + publish_content_link: Optional["_models.ContentLink"] = None, + state: Optional[Union[str, "_models.RunbookState"]] = None, + log_verbose: Optional[bool] = None, + 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, + draft: Optional["_models.RunbookDraft"] = None, + provisioning_state: Optional[Literal["Succeeded"]] = None, + last_modified_by: Optional[str] = None, + creation_time: Optional[datetime.datetime] = None, + last_modified_time: Optional[datetime.datetime] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RunbookUpdateParameters(_Model): + """The parameters supplied to the update runbook operation. + + :ivar properties: Gets or sets the runbook update properties. + :vartype properties: ~azure.mgmt.automation.models.RunbookUpdateProperties + :ivar name: Gets or sets the name of the resource. + :vartype name: str + :ivar location: Gets or sets the location of the resource. + :vartype location: str + :ivar tags: Gets or sets the tags attached to the resource. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.RunbookUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the runbook update properties.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the resource.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the location of the resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the tags attached to the resource.""" + + __flattened_items = ["description", "log_verbose", "log_progress", "log_activity_trace"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.RunbookUpdateProperties"] = None, + name: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class RunbookUpdateProperties(_Model): + """The parameters supplied to the update runbook properties. + + :ivar description: Gets or sets the description of the runbook. + :vartype description: str + :ivar log_verbose: Gets or sets verbose log option. + :vartype log_verbose: bool + :ivar log_progress: Gets or sets progress log option. + :vartype log_progress: bool + :ivar log_activity_trace: Gets or sets the activity-level tracing options of the runbook. + :vartype log_activity_trace: int + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the runbook.""" + log_verbose: Optional[bool] = rest_field( + name="logVerbose", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets verbose log option.""" + log_progress: Optional[bool] = rest_field( + name="logProgress", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets progress log option.""" + log_activity_trace: Optional[int] = rest_field( + name="logActivityTrace", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the activity-level tracing options of the runbook.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + log_verbose: Optional[bool] = None, + log_progress: Optional[bool] = None, + log_activity_trace: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RuntimeEnvironment(TrackedResource): + """Definition of the Runtime Environment type. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Gets or sets the Runtime Environment properties. + :vartype properties: ~azure.mgmt.automation.models.RuntimeEnvironmentProperties + """ + + properties: Optional["_models.RuntimeEnvironmentProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Runtime Environment properties.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.RuntimeEnvironmentProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RuntimeEnvironmentProperties(_Model): + """Runtime Environment properties. + + :ivar runtime: Runtime properties. + :vartype runtime: ~azure.mgmt.automation.models.RuntimeProperties + :ivar default_packages: List of Default packages for Environment. + :vartype default_packages: dict[str, str] + :ivar description: Gets or sets the description. + :vartype description: str + """ + + runtime: Optional["_models.RuntimeProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Runtime properties.""" + default_packages: Optional[dict[str, str]] = rest_field( + name="defaultPackages", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Default packages for Environment.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + + __flattened_items = ["language", "version"] + + @overload + def __init__( + self, + *, + runtime: Optional["_models.RuntimeProperties"] = None, + default_packages: Optional[dict[str, str]] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.runtime is None: + return None + return getattr(self.runtime, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.runtime is None: + self.runtime = self._attr_to_rest_field["runtime"]._class_type() + setattr(self.runtime, key, value) + else: + super().__setattr__(key, value) + + +class RuntimeEnvironmentUpdateParameters(_Model): + """The parameters supplied to the update automation account operation. + + :ivar properties: Gets or sets Runtime update properties. + :vartype properties: ~azure.mgmt.automation.models.RuntimeEnvironmentUpdateProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + """ + + properties: Optional["_models.RuntimeEnvironmentUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets Runtime update properties.""" + system_data: Optional["_models.SystemData"] = rest_field( + name="systemData", visibility=["read", "create", "update", "delete", "query"] + ) + """Metadata pertaining to creation and last modification of the resource.""" + + __flattened_items = ["default_packages"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.RuntimeEnvironmentUpdateProperties"] = None, + system_data: Optional["_models.SystemData"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class RuntimeEnvironmentUpdateProperties(_Model): + """Gets or sets Runtime update properties. + + :ivar default_packages: List of Default packages for Environment. + :vartype default_packages: dict[str, str] + """ + + default_packages: Optional[dict[str, str]] = rest_field( + name="defaultPackages", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Default packages for Environment.""" + + @overload + def __init__( + self, + *, + default_packages: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RuntimeProperties(_Model): + """Runtime properties. + + :ivar language: Language of Runtime Environment. + :vartype language: str + :ivar version: Version of Language. + :vartype version: str + """ + + language: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Language of Runtime Environment.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Version of Language.""" + + @overload + def __init__( + self, + *, + language: Optional[str] = None, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Schedule(ProxyResource): + """Definition of the schedule. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Gets or sets the properties of the schedule. + :vartype properties: ~azure.mgmt.automation.models.ScheduleProperties + """ + + properties: Optional["_models.ScheduleProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the schedule.""" + + __flattened_items = [ + "start_time", + "start_time_offset_minutes", + "expiry_time", + "expiry_time_offset_minutes", + "is_enabled", + "next_run", + "next_run_offset_minutes", + "interval", + "frequency", + "time_zone", + "advanced_schedule", + "creation_time", + "last_modified_time", + "description", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ScheduleProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ScheduleAssociationProperty(_Model): + """The schedule property associated with the entity. + + :ivar name: Gets or sets the name of the Schedule. + :vartype name: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the Schedule.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScheduleCreateOrUpdateParameters(_Model): + """The parameters supplied to the create or update schedule operation. + + :ivar name: Gets or sets the name of the Schedule. Required. + :vartype name: str + :ivar properties: Gets or sets the list of schedule properties. Required. + :vartype properties: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateProperties + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the Schedule. Required.""" + properties: "_models.ScheduleCreateOrUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of schedule properties. Required.""" + + __flattened_items = [ + "description", + "start_time", + "expiry_time", + "interval", + "frequency", + "time_zone", + "advanced_schedule", + ] + + @overload + def __init__( + self, + *, + name: str, + properties: "_models.ScheduleCreateOrUpdateProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ScheduleCreateOrUpdateProperties(_Model): + """The parameters supplied to the create or update schedule operation. + + :ivar description: Gets or sets the description of the schedule. + :vartype description: str + :ivar start_time: Gets or sets the start time of the schedule. Required. + :vartype start_time: ~datetime.datetime + :ivar expiry_time: Gets or sets the end time of the schedule. + :vartype expiry_time: ~datetime.datetime + :ivar interval: Gets or sets the interval of the schedule. + :vartype interval: any + :ivar frequency: Gets or sets the frequency of the schedule. Required. 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 AdvancedSchedule. + :vartype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the schedule.""" + start_time: datetime.datetime = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the start time of the schedule. Required.""" + expiry_time: Optional[datetime.datetime] = rest_field( + name="expiryTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the end time of the schedule.""" + interval: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the interval of the schedule.""" + frequency: Union[str, "_models.ScheduleFrequency"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the frequency of the schedule. Required. Known values are: \"OneTime\", \"Day\", + \"Hour\", \"Week\", \"Month\", and \"Minute\".""" + time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the time zone of the schedule.""" + advanced_schedule: Optional["_models.AdvancedSchedule"] = rest_field( + name="advancedSchedule", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the AdvancedSchedule.""" + + @overload + def __init__( + self, + *, + start_time: datetime.datetime, + frequency: Union[str, "_models.ScheduleFrequency"], + description: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + interval: Optional[Any] = None, + time_zone: Optional[str] = None, + advanced_schedule: Optional["_models.AdvancedSchedule"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScheduleProperties(_Model): + """Definition of schedule parameters. + + :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: any + :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 + """ + + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the start time of the schedule.""" + start_time_offset_minutes: Optional[float] = rest_field(name="startTimeOffsetMinutes", visibility=["read"]) + """Gets the start time's offset in minutes.""" + expiry_time: Optional[datetime.datetime] = rest_field( + name="expiryTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the end time of the schedule.""" + expiry_time_offset_minutes: Optional[float] = rest_field( + name="expiryTimeOffsetMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the expiry time's offset in minutes.""" + is_enabled: Optional[bool] = rest_field( + name="isEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether this schedule is enabled.""" + next_run: Optional[datetime.datetime] = rest_field( + name="nextRun", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the next run time of the schedule.""" + next_run_offset_minutes: Optional[float] = rest_field( + name="nextRunOffsetMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the next run time's offset in minutes.""" + interval: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the interval of the schedule.""" + frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the frequency of the schedule. Known values are: \"OneTime\", \"Day\", \"Hour\", + \"Week\", \"Month\", and \"Minute\".""" + time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the time zone of the schedule.""" + advanced_schedule: Optional["_models.AdvancedSchedule"] = rest_field( + name="advancedSchedule", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the advanced schedule.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + + @overload + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + expiry_time: Optional[datetime.datetime] = None, + expiry_time_offset_minutes: Optional[float] = None, + is_enabled: Optional[bool] = None, + next_run: Optional[datetime.datetime] = None, + next_run_offset_minutes: Optional[float] = None, + interval: Optional[Any] = 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScheduleUpdateParameters(_Model): + """The parameters supplied to the update schedule operation. + + :ivar name: Gets or sets the name of the Schedule. + :vartype name: str + :ivar properties: Gets or sets the list of schedule properties. + :vartype properties: ~azure.mgmt.automation.models.ScheduleUpdateProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the Schedule.""" + properties: Optional["_models.ScheduleUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the list of schedule properties.""" + + __flattened_items = ["description", "is_enabled"] + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.ScheduleUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ScheduleUpdateProperties(_Model): + """The parameters supplied to the update schedule operation. + + :ivar description: Gets or sets the description of the schedule. + :vartype description: str + :ivar is_enabled: Gets or sets a value indicating whether this schedule is enabled. + :vartype is_enabled: bool + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the schedule.""" + is_enabled: Optional[bool] = rest_field( + name="isEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether this schedule is enabled.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + is_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Sku(_Model): + """The account SKU. + + :ivar name: Gets or sets the SKU name of the account. Required. Known values are: "Free" and + "Basic". + :vartype name: str or ~azure.mgmt.automation.models.SkuNameEnum + :ivar family: Gets or sets the SKU family. + :vartype family: str + :ivar capacity: Gets or sets the SKU capacity. + :vartype capacity: int + """ + + name: Union[str, "_models.SkuNameEnum"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the SKU name of the account. Required. Known values are: \"Free\" and \"Basic\".""" + family: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the SKU family.""" + capacity: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the SKU capacity.""" + + @overload + def __init__( + self, + *, + name: Union[str, "_models.SkuNameEnum"], + family: Optional[str] = None, + capacity: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SoftwareUpdateConfiguration(ProxyResource): + """Software update configuration properties. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Software update configuration properties. Required. + :vartype properties: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationProperties + """ + + properties: "_models.SoftwareUpdateConfigurationProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Software update configuration properties. Required.""" + + __flattened_items = [ + "update_configuration", + "schedule_info", + "provisioning_state", + "error", + "creation_time", + "created_by", + "last_modified_time", + "last_modified_by", + "tasks", + ] + + @overload + def __init__( + self, + *, + properties: "_models.SoftwareUpdateConfigurationProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SoftwareUpdateConfigurationCollectionItem(_Model): # pylint: disable=name-too-long + """Software update configuration collection item properties. + + :ivar name: Name of the software update configuration. + :vartype name: str + :ivar id: Resource Id of the software update configuration. + :vartype id: str + :ivar properties: Software update configuration properties. Required. + :vartype properties: + ~azure.mgmt.automation.models.SoftwareUpdateConfigurationCollectionItemProperties + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the software update configuration.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Resource Id of the software update configuration.""" + properties: "_models.SoftwareUpdateConfigurationCollectionItemProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Software update configuration properties. Required.""" + + __flattened_items = [ + "update_configuration", + "tasks", + "frequency", + "start_time", + "creation_time", + "last_modified_time", + "provisioning_state", + "next_run", + ] + + @overload + def __init__( + self, + *, + properties: "_models.SoftwareUpdateConfigurationCollectionItemProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SoftwareUpdateConfigurationCollectionItemProperties(_Model): # pylint: disable=name-too-long + """Software update configuration collection item properties. + + :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 + :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 + :ivar start_time: the start time of the update. + :vartype start_time: ~datetime.datetime + :ivar creation_time: Creation time of the software update configuration, which only appears in + the response. + :vartype creation_time: ~datetime.datetime + :ivar last_modified_time: Last time software update configuration was modified, which only + appears in the response. + :vartype last_modified_time: ~datetime.datetime + :ivar provisioning_state: Provisioning state for the software update configuration, which only + appears in the response. + :vartype provisioning_state: str + :ivar next_run: ext run time of the update. + :vartype next_run: ~datetime.datetime + """ + + update_configuration: Optional["_models.UpdateConfiguration"] = rest_field( + name="updateConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Update specific properties of the software update configuration.""" + tasks: Optional["_models.SoftwareUpdateConfigurationTasks"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Pre and Post Tasks defined.""" + frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """execution frequency of the schedule associated with the software update configuration. Known + values are: \"OneTime\", \"Day\", \"Hour\", \"Week\", \"Month\", and \"Minute\".""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """the start time of the update.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Creation time of the software update configuration, which only appears in the response.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read"], format="rfc3339" + ) + """Last time software update configuration was modified, which only appears in the response.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """Provisioning state for the software update configuration, which only appears in the response.""" + next_run: Optional[datetime.datetime] = rest_field( + name="nextRun", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """ext run time of the update.""" + + @overload + def __init__( + self, + *, + update_configuration: Optional["_models.UpdateConfiguration"] = None, + tasks: Optional["_models.SoftwareUpdateConfigurationTasks"] = None, + frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = None, + start_time: Optional[datetime.datetime] = None, + next_run: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SoftwareUpdateConfigurationListResult(_Model): + """result of listing all software update configuration. + + :ivar value: outer object returned when listing all software update configurations. + :vartype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationCollectionItem] + """ + + value: Optional[list["_models.SoftwareUpdateConfigurationCollectionItem"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """outer object returned when listing all software update configurations.""" + + @overload + def __init__( + self, + *, + value: Optional[list["_models.SoftwareUpdateConfigurationCollectionItem"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SoftwareUpdateConfigurationMachineRun(_Model): + """Software update configuration machine run model. + + :ivar name: Name of the software update configuration machine run. + :vartype name: str + :ivar id: Resource Id of the software update configuration machine run. + :vartype id: str + :ivar properties: Software update configuration machine run properties. + :vartype properties: ~azure.mgmt.automation.models.UpdateConfigurationMachineRunProperties + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the software update configuration machine run.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Resource Id of the software update configuration machine run.""" + properties: Optional["_models.UpdateConfigurationMachineRunProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Software update configuration machine run properties.""" + + __flattened_items = [ + "target_computer", + "target_computer_type", + "software_update_configuration", + "status", + "os_type", + "correlation_id", + "source_computer_id", + "start_time", + "end_time", + "configured_duration", + "job", + "creation_time", + "created_by", + "last_modified_time", + "last_modified_by", + "error", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.UpdateConfigurationMachineRunProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SoftwareUpdateConfigurationMachineRunListResult(_Model): # pylint: disable=name-too-long + """result of listing all software update configuration machine runs. + + :ivar value: The softwareUpdateConfigurationMachineRun items on this page. Required. + :vartype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: list["_models.SoftwareUpdateConfigurationMachineRun"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The softwareUpdateConfigurationMachineRun items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: list["_models.SoftwareUpdateConfigurationMachineRun"], + next_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SoftwareUpdateConfigurationProperties(_Model): + """Software update configuration properties. + + :ivar update_configuration: update specific properties for the Software update configuration. + 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 + :ivar provisioning_state: Provisioning state for the software update configuration, which only + appears in the response. + :vartype provisioning_state: str + :ivar error: Details of provisioning error. + :vartype error: ~azure.mgmt.automation.models.AutomationErrorResponse + :ivar creation_time: Creation time of the resource, which only appears in the response. + :vartype creation_time: ~datetime.datetime + :ivar created_by: CreatedBy property, which only appears in the response. + :vartype created_by: str + :ivar last_modified_time: Last time resource was modified, which only appears in the response. + :vartype last_modified_time: ~datetime.datetime + :ivar last_modified_by: LastModifiedBy property, which only appears in the response. + :vartype last_modified_by: str + :ivar tasks: Tasks information for the Software update configuration. + :vartype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks + """ + + update_configuration: "_models.UpdateConfiguration" = rest_field( + name="updateConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """update specific properties for the Software update configuration. Required.""" + schedule_info: "_models.SUCScheduleProperties" = rest_field( + name="scheduleInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Schedule information for the Software update configuration. Required.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """Provisioning state for the software update configuration, which only appears in the response.""" + error: Optional["_models.AutomationErrorResponse"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Details of provisioning error.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Creation time of the resource, which only appears in the response.""" + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read"]) + """CreatedBy property, which only appears in the response.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read"], format="rfc3339" + ) + """Last time resource was modified, which only appears in the response.""" + last_modified_by: Optional[str] = rest_field(name="lastModifiedBy", visibility=["read"]) + """LastModifiedBy property, which only appears in the response.""" + tasks: Optional["_models.SoftwareUpdateConfigurationTasks"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Tasks information for the Software update configuration.""" + + @overload + def __init__( + self, + *, + update_configuration: "_models.UpdateConfiguration", + schedule_info: "_models.SUCScheduleProperties", + error: Optional["_models.AutomationErrorResponse"] = None, + tasks: Optional["_models.SoftwareUpdateConfigurationTasks"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SoftwareUpdateConfigurationRun(_Model): + """Software update configuration Run properties. + + :ivar name: Name of the software update configuration run. + :vartype name: str + :ivar id: Resource Id of the software update configuration run. + :vartype id: str + :ivar properties: Software update configuration Run properties. + :vartype properties: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunProperties + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the software update configuration run.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Resource Id of the software update configuration run.""" + properties: Optional["_models.SoftwareUpdateConfigurationRunProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Software update configuration Run properties.""" + + __flattened_items = [ + "software_update_configuration", + "status", + "configured_duration", + "os_type", + "start_time", + "end_time", + "computer_count", + "failed_count", + "creation_time", + "created_by", + "last_modified_time", + "last_modified_by", + "tasks", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.SoftwareUpdateConfigurationRunProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SoftwareUpdateConfigurationRunListResult(_Model): + """result of listing all software update configuration runs. + + :ivar value: The softwareUpdateConfigurationRun items on this page. Required. + :vartype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: list["_models.SoftwareUpdateConfigurationRun"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The softwareUpdateConfigurationRun items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: list["_models.SoftwareUpdateConfigurationRun"], + next_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SoftwareUpdateConfigurationRunProperties(_Model): + """Software update configuration properties. + + :ivar software_update_configuration: software update configuration triggered this run. + :vartype software_update_configuration: + ~azure.mgmt.automation.models.UpdateConfigurationNavigation + :ivar status: Status of the software update configuration run. + :vartype status: str + :ivar configured_duration: Configured duration for the software update configuration run. + :vartype configured_duration: str + :ivar os_type: Operating system target of the software update configuration triggered this run. + :vartype os_type: str + :ivar start_time: Start time of the software update configuration run. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of the software update configuration run. + :vartype end_time: ~datetime.datetime + :ivar computer_count: Number of computers in the software update configuration run. + :vartype computer_count: int + :ivar failed_count: Number of computers with failed status. + :vartype failed_count: int + :ivar creation_time: Creation time of the resource, which only appears in the response. + :vartype creation_time: ~datetime.datetime + :ivar created_by: CreatedBy property, which only appears in the response. + :vartype created_by: str + :ivar last_modified_time: Last time resource was modified, which only appears in the response. + :vartype last_modified_time: ~datetime.datetime + :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 + """ + + software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = rest_field( + name="softwareUpdateConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """software update configuration triggered this run.""" + status: Optional[str] = rest_field(visibility=["read"]) + """Status of the software update configuration run.""" + configured_duration: Optional[str] = rest_field(name="configuredDuration", visibility=["read"]) + """Configured duration for the software update configuration run.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read"]) + """Operating system target of the software update configuration triggered this run.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Start time of the software update configuration run.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """End time of the software update configuration run.""" + computer_count: Optional[int] = rest_field(name="computerCount", visibility=["read"]) + """Number of computers in the software update configuration run.""" + failed_count: Optional[int] = rest_field(name="failedCount", visibility=["read"]) + """Number of computers with failed status.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Creation time of the resource, which only appears in the response.""" + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read"]) + """CreatedBy property, which only appears in the response.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read"], format="rfc3339" + ) + """Last time resource was modified, which only appears in the response.""" + last_modified_by: Optional[str] = rest_field(name="lastModifiedBy", visibility=["read"]) + """LastModifiedBy property, which only appears in the response.""" + tasks: Optional["_models.SoftwareUpdateConfigurationRunTasks"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Software update configuration tasks triggered in this run.""" + + @overload + def __init__( + self, + *, + software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = None, + tasks: Optional["_models.SoftwareUpdateConfigurationRunTasks"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SoftwareUpdateConfigurationRunTaskProperties(_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 + """ + + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The status of the task.""" + source: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the source of the task.""" + job_id: Optional[str] = rest_field(name="jobId", visibility=["read", "create", "update", "delete", "query"]) + """The job id of the task.""" + + @overload + def __init__( + self, + *, + status: Optional[str] = None, + source: Optional[str] = None, + job_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SoftwareUpdateConfigurationRunTasks(_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 + """ + + pre_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = rest_field( + name="preTask", visibility=["read", "create", "update", "delete", "query"] + ) + """Pre task properties.""" + post_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = rest_field( + name="postTask", visibility=["read", "create", "update", "delete", "query"] + ) + """Post task properties.""" + + @overload + def __init__( + self, + *, + pre_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = None, + post_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SoftwareUpdateConfigurationTasks(_Model): + """Task properties of the software update configuration. + + :ivar pre_task: Pre task properties. + :vartype pre_task: ~azure.mgmt.automation.models.TaskProperties + :ivar post_task: Post task properties. + :vartype post_task: ~azure.mgmt.automation.models.TaskProperties + """ + + pre_task: Optional["_models.TaskProperties"] = rest_field( + name="preTask", visibility=["read", "create", "update", "delete", "query"] + ) + """Pre task properties.""" + post_task: Optional["_models.TaskProperties"] = rest_field( + name="postTask", visibility=["read", "create", "update", "delete", "query"] + ) + """Post task properties.""" + + @overload + def __init__( + self, + *, + pre_task: Optional["_models.TaskProperties"] = None, + post_task: Optional["_models.TaskProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SourceControl(ProxyResource): + """Definition of the source control. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: The properties of the source control. + :vartype properties: ~azure.mgmt.automation.models.SourceControlProperties + """ + + properties: Optional["_models.SourceControlProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the source control.""" + + __flattened_items = [ + "repo_url", + "branch", + "folder_path", + "auto_sync", + "publish_runbook", + "source_type", + "description", + "creation_time", + "last_modified_time", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.SourceControlProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SourceControlCreateOrUpdateParameters(_Model): + """The parameters supplied to the create or update source control operation. + + :ivar properties: The properties of the source control. Required. + :vartype properties: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateProperties + """ + + properties: "_models.SourceControlCreateOrUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the source control. Required.""" + + __flattened_items = [ + "repo_url", + "branch", + "folder_path", + "auto_sync", + "publish_runbook", + "source_type", + "security_token", + "description", + ] + + @overload + def __init__( + self, + *, + properties: "_models.SourceControlCreateOrUpdateProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SourceControlCreateOrUpdateProperties(_Model): + """The properties of the create source control operation. + + :ivar repo_url: The repo url of the source control. + :vartype repo_url: str + :ivar branch: The repo branch of the source control. Include branch as empty string for + VsoTfvc. + :vartype branch: str + :ivar folder_path: The folder path of the source control. Path must be relative. + :vartype folder_path: str + :ivar auto_sync: The auto async of the source control. Default is false. + :vartype auto_sync: bool + :ivar publish_runbook: The auto publish of the source control. Default is true. + :vartype publish_runbook: bool + :ivar source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub, case sensitive. + Known values are: "VsoGit", "VsoTfvc", and "GitHub". + :vartype source_type: str or ~azure.mgmt.automation.models.SourceType + :ivar security_token: The authorization token for the repo of the source control. + :vartype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties + :ivar description: The user description of the source control. + :vartype description: str + """ + + repo_url: Optional[str] = rest_field(name="repoUrl", visibility=["read", "create", "update", "delete", "query"]) + """The repo url of the source control.""" + branch: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The repo branch of the source control. Include branch as empty string for VsoTfvc.""" + folder_path: Optional[str] = rest_field( + name="folderPath", visibility=["read", "create", "update", "delete", "query"] + ) + """The folder path of the source control. Path must be relative.""" + auto_sync: Optional[bool] = rest_field(name="autoSync", visibility=["read", "create", "update", "delete", "query"]) + """The auto async of the source control. Default is false.""" + publish_runbook: Optional[bool] = rest_field( + name="publishRunbook", visibility=["read", "create", "update", "delete", "query"] + ) + """The auto publish of the source control. Default is true.""" + source_type: Optional[Union[str, "_models.SourceType"]] = rest_field( + name="sourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The source type. Must be one of VsoGit, VsoTfvc, GitHub, case sensitive. Known values are: + \"VsoGit\", \"VsoTfvc\", and \"GitHub\".""" + security_token: Optional["_models.SourceControlSecurityTokenProperties"] = rest_field( + name="securityToken", visibility=["read", "create", "update", "delete", "query"] + ) + """The authorization token for the repo of the source control.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The user description of the source control.""" + + @overload + def __init__( + self, + *, + repo_url: Optional[str] = None, + branch: Optional[str] = None, + folder_path: Optional[str] = None, + auto_sync: Optional[bool] = None, + publish_runbook: Optional[bool] = None, + source_type: Optional[Union[str, "_models.SourceType"]] = None, + security_token: Optional["_models.SourceControlSecurityTokenProperties"] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SourceControlProperties(_Model): + """Definition of the source control properties. + + :ivar repo_url: The repo url of the source control. + :vartype repo_url: str + :ivar branch: The repo branch of the source control. Include branch as empty string for + VsoTfvc. + :vartype branch: str + :ivar folder_path: The folder path of the source control. + :vartype folder_path: str + :ivar auto_sync: The auto sync of the source control. Default is false. + :vartype auto_sync: bool + :ivar publish_runbook: The auto publish of the source control. Default is true. + :vartype publish_runbook: bool + :ivar source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub. Known values are: + "VsoGit", "VsoTfvc", and "GitHub". + :vartype source_type: str or ~azure.mgmt.automation.models.SourceType + :ivar description: The description. + :vartype description: str + :ivar creation_time: The creation time. + :vartype creation_time: ~datetime.datetime + :ivar last_modified_time: The last modified time. + :vartype last_modified_time: ~datetime.datetime + """ + + repo_url: Optional[str] = rest_field(name="repoUrl", visibility=["read", "create", "update", "delete", "query"]) + """The repo url of the source control.""" + branch: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The repo branch of the source control. Include branch as empty string for VsoTfvc.""" + folder_path: Optional[str] = rest_field( + name="folderPath", visibility=["read", "create", "update", "delete", "query"] + ) + """The folder path of the source control.""" + auto_sync: Optional[bool] = rest_field(name="autoSync", visibility=["read", "create", "update", "delete", "query"]) + """The auto sync of the source control. Default is false.""" + publish_runbook: Optional[bool] = rest_field( + name="publishRunbook", visibility=["read", "create", "update", "delete", "query"] + ) + """The auto publish of the source control. Default is true.""" + source_type: Optional[Union[str, "_models.SourceType"]] = rest_field( + name="sourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The source type. Must be one of VsoGit, VsoTfvc, GitHub. Known values are: \"VsoGit\", + \"VsoTfvc\", and \"GitHub\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last modified time.""" + + @overload + def __init__( + self, + *, + repo_url: Optional[str] = None, + branch: Optional[str] = None, + folder_path: Optional[str] = None, + auto_sync: Optional[bool] = None, + publish_runbook: Optional[bool] = None, + source_type: Optional[Union[str, "_models.SourceType"]] = None, + description: Optional[str] = None, + creation_time: Optional[datetime.datetime] = None, + last_modified_time: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SourceControlSecurityTokenProperties(_Model): + """SourceControlSecurityTokenProperties. + + :ivar access_token: The access token. + :vartype access_token: str + :ivar refresh_token: The refresh token. + :vartype refresh_token: str + :ivar token_type: The token type. Must be either PersonalAccessToken or Oauth. Known values + are: "PersonalAccessToken" and "Oauth". + :vartype token_type: str or ~azure.mgmt.automation.models.TokenType + """ + + access_token: Optional[str] = rest_field( + name="accessToken", visibility=["read", "create", "update", "delete", "query"] + ) + """The access token.""" + refresh_token: Optional[str] = rest_field( + name="refreshToken", visibility=["read", "create", "update", "delete", "query"] + ) + """The refresh token.""" + token_type: Optional[Union[str, "_models.TokenType"]] = rest_field( + name="tokenType", visibility=["read", "create", "update", "delete", "query"] + ) + """The token type. Must be either PersonalAccessToken or Oauth. Known values are: + \"PersonalAccessToken\" and \"Oauth\".""" + + @overload + def __init__( + self, + *, + access_token: Optional[str] = None, + refresh_token: Optional[str] = None, + token_type: Optional[Union[str, "_models.TokenType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SourceControlSyncJob(_Model): + """Definition of the source control sync job. + + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar id: Resource id. + :vartype id: str + :ivar properties: The properties of the source control sync job. + :vartype properties: ~azure.mgmt.automation.models.SourceControlSyncJobProperties + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Resource name.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Resource type.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Resource id.""" + properties: Optional["_models.SourceControlSyncJobProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the source control sync job.""" + + __flattened_items = [ + "source_control_sync_job_id", + "creation_time", + "provisioning_state", + "start_time", + "end_time", + "sync_type", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.SourceControlSyncJobProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SourceControlSyncJobById(_Model): + """Definition of the source control sync job. + + :ivar id: The id of the job. + :vartype id: str + :ivar properties: The properties of the source control sync job. + :vartype properties: ~azure.mgmt.automation.models.SourceControlSyncJobByIdProperties + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The id of the job.""" + properties: Optional["_models.SourceControlSyncJobByIdProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the source control sync job.""" + + __flattened_items = [ + "source_control_sync_job_id", + "creation_time", + "provisioning_state", + "start_time", + "end_time", + "sync_type", + "exception", + ] + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + properties: Optional["_models.SourceControlSyncJobByIdProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SourceControlSyncJobByIdProperties(_Model): + """Definition of source control sync job properties. + + :ivar source_control_sync_job_id: The source control sync job id. + :vartype source_control_sync_job_id: str + :ivar creation_time: The creation time of the job. + :vartype creation_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the job. Known values are: "Completed", + "Failed", and "Running". + :vartype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState + :ivar start_time: The start time of the job. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the job. + :vartype end_time: ~datetime.datetime + :ivar sync_type: The sync type. Known values are: "PartialSync" and "FullSync". + :vartype sync_type: str or ~azure.mgmt.automation.models.SyncType + :ivar exception: The exceptions that occurred while running the sync job. + :vartype exception: str + """ + + source_control_sync_job_id: Optional[str] = rest_field( + name="sourceControlSyncJobId", visibility=["read", "create", "update", "delete", "query"] + ) + """The source control sync job id.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """The creation time of the job.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """The provisioning state of the job. Known values are: \"Completed\", \"Failed\", and + \"Running\".""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """The start time of the job.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """The end time of the job.""" + sync_type: Optional[Union[str, "_models.SyncType"]] = rest_field( + name="syncType", visibility=["read", "create", "update", "delete", "query"] + ) + """The sync type. Known values are: \"PartialSync\" and \"FullSync\".""" + exception: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The exceptions that occurred while running the sync job.""" + + @overload + def __init__( + self, + *, + source_control_sync_job_id: Optional[str] = None, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + sync_type: Optional[Union[str, "_models.SyncType"]] = None, + exception: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SourceControlSyncJobCreateParameters(_Model): + """The parameters supplied to the create source control sync job operation. + + :ivar properties: The properties of the source control sync job. Required. + :vartype properties: ~azure.mgmt.automation.models.SourceControlSyncJobCreateProperties + """ + + properties: "_models.SourceControlSyncJobCreateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the source control sync job. Required.""" + + __flattened_items = ["commit_id"] + + @overload + def __init__( + self, + *, + properties: "_models.SourceControlSyncJobCreateProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SourceControlSyncJobCreateProperties(_Model): + """Definition of create source control sync job properties. + + :ivar commit_id: The commit id of the source control sync job. If not syncing to a commitId, + enter an empty string. Required. + :vartype commit_id: str + """ + + commit_id: str = rest_field(name="commitId", visibility=["read", "create", "update", "delete", "query"]) + """The commit id of the source control sync job. If not syncing to a commitId, enter an empty + string. Required.""" + + @overload + def __init__( + self, + *, + commit_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SourceControlSyncJobProperties(_Model): + """Definition of source control sync job properties. + + :ivar source_control_sync_job_id: The source control sync job id. + :vartype source_control_sync_job_id: str + :ivar creation_time: The creation time of the job. + :vartype creation_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the job. Known values are: "Completed", + "Failed", and "Running". + :vartype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState + :ivar start_time: The start time of the job. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the job. + :vartype end_time: ~datetime.datetime + :ivar sync_type: The sync type. Known values are: "PartialSync" and "FullSync". + :vartype sync_type: str or ~azure.mgmt.automation.models.SyncType + """ + + source_control_sync_job_id: Optional[str] = rest_field( + name="sourceControlSyncJobId", visibility=["read", "create", "update", "delete", "query"] + ) + """The source control sync job id.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """The creation time of the job.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """The provisioning state of the job. Known values are: \"Completed\", \"Failed\", and + \"Running\".""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """The start time of the job.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """The end time of the job.""" + sync_type: Optional[Union[str, "_models.SyncType"]] = rest_field( + name="syncType", visibility=["read", "create", "update", "delete", "query"] + ) + """The sync type. Known values are: \"PartialSync\" and \"FullSync\".""" + + @overload + def __init__( + self, + *, + source_control_sync_job_id: Optional[str] = None, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + sync_type: Optional[Union[str, "_models.SyncType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SourceControlSyncJobStream(_Model): + """Definition of the source control sync job stream. + + :ivar id: Resource id. + :vartype id: str + :ivar properties: The properties of the source control sync job stream. + :vartype properties: ~azure.mgmt.automation.models.SourceControlSyncJobStreamProperties + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Resource id.""" + properties: Optional["_models.SourceControlSyncJobStreamProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the source control sync job stream.""" + + __flattened_items = ["source_control_sync_job_stream_id", "summary", "time", "stream_type"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.SourceControlSyncJobStreamProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SourceControlSyncJobStreamById(_Model): + """Definition of the source control sync job stream by id. + + :ivar id: Resource id. + :vartype id: str + :ivar properties: The properties of the source control sync job stream. + :vartype properties: ~azure.mgmt.automation.models.SourceControlSyncJobStreamByIdProperties + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Resource id.""" + properties: Optional["_models.SourceControlSyncJobStreamByIdProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the source control sync job stream.""" + + __flattened_items = ["source_control_sync_job_stream_id", "summary", "time", "stream_type", "stream_text", "value"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.SourceControlSyncJobStreamByIdProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SourceControlSyncJobStreamByIdProperties(_Model): + """Definition of source control sync job stream by id properties. + + :ivar source_control_sync_job_stream_id: The sync job stream id. + :vartype source_control_sync_job_stream_id: str + :ivar summary: The summary of the sync job stream. + :vartype summary: str + :ivar time: The time of the sync job stream. + :vartype time: ~datetime.datetime + :ivar stream_type: The type of the sync job stream. Known values are: "Error" and "Output". + :vartype stream_type: str or ~azure.mgmt.automation.models.StreamType + :ivar stream_text: The text of the sync job stream. + :vartype stream_text: str + :ivar value: The values of the job stream. + :vartype value: dict[str, any] + """ + + source_control_sync_job_stream_id: Optional[str] = rest_field( + name="sourceControlSyncJobStreamId", visibility=["read", "create", "update", "delete", "query"] + ) + """The sync job stream id.""" + summary: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The summary of the sync job stream.""" + time: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339") + """The time of the sync job stream.""" + stream_type: Optional[Union[str, "_models.StreamType"]] = rest_field( + name="streamType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the sync job stream. Known values are: \"Error\" and \"Output\".""" + stream_text: Optional[str] = rest_field( + name="streamText", visibility=["read", "create", "update", "delete", "query"] + ) + """The text of the sync job stream.""" + value: Optional[dict[str, Any]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The values of the job stream.""" + + @overload + def __init__( + self, + *, + source_control_sync_job_stream_id: Optional[str] = None, + summary: Optional[str] = None, + stream_type: Optional[Union[str, "_models.StreamType"]] = None, + stream_text: Optional[str] = None, + value: Optional[dict[str, Any]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SourceControlSyncJobStreamProperties(_Model): + """Definition of source control sync job stream properties. + + :ivar source_control_sync_job_stream_id: The sync job stream id. + :vartype source_control_sync_job_stream_id: str + :ivar summary: The summary of the sync job stream. + :vartype summary: str + :ivar time: The time of the sync job stream. + :vartype time: ~datetime.datetime + :ivar stream_type: The type of the sync job stream. Known values are: "Error" and "Output". + :vartype stream_type: str or ~azure.mgmt.automation.models.StreamType + """ + + source_control_sync_job_stream_id: Optional[str] = rest_field( + name="sourceControlSyncJobStreamId", visibility=["read", "create", "update", "delete", "query"] + ) + """The sync job stream id.""" + summary: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The summary of the sync job stream.""" + time: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339") + """The time of the sync job stream.""" + stream_type: Optional[Union[str, "_models.StreamType"]] = rest_field( + name="streamType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the sync job stream. Known values are: \"Error\" and \"Output\".""" + + @overload + def __init__( + self, + *, + source_control_sync_job_stream_id: Optional[str] = None, + summary: Optional[str] = None, + stream_type: Optional[Union[str, "_models.StreamType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SourceControlUpdateParameters(_Model): + """The parameters supplied to the update source control operation. + + :ivar properties: The value of the source control. + :vartype properties: ~azure.mgmt.automation.models.SourceControlUpdateProperties + """ + + properties: Optional["_models.SourceControlUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The value of the source control.""" + + __flattened_items = ["branch", "folder_path", "auto_sync", "publish_runbook", "security_token", "description"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.SourceControlUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SourceControlUpdateProperties(_Model): + """The properties of the update source control. + + :ivar branch: The repo branch of the source control. + :vartype branch: str + :ivar folder_path: The folder path of the source control. Path must be relative. + :vartype folder_path: str + :ivar auto_sync: The auto sync of the source control. Default is false. + :vartype auto_sync: bool + :ivar publish_runbook: The auto publish of the source control. Default is true. + :vartype publish_runbook: bool + :ivar security_token: The authorization token for the repo of the source control. + :vartype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties + :ivar description: The user description of the source control. + :vartype description: str + """ + + branch: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The repo branch of the source control.""" + folder_path: Optional[str] = rest_field( + name="folderPath", visibility=["read", "create", "update", "delete", "query"] + ) + """The folder path of the source control. Path must be relative.""" + auto_sync: Optional[bool] = rest_field(name="autoSync", visibility=["read", "create", "update", "delete", "query"]) + """The auto sync of the source control. Default is false.""" + publish_runbook: Optional[bool] = rest_field( + name="publishRunbook", visibility=["read", "create", "update", "delete", "query"] + ) + """The auto publish of the source control. Default is true.""" + security_token: Optional["_models.SourceControlSecurityTokenProperties"] = rest_field( + name="securityToken", visibility=["read", "create", "update", "delete", "query"] + ) + """The authorization token for the repo of the source control.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The user description of the source control.""" + + @overload + def __init__( + self, + *, + branch: Optional[str] = None, + folder_path: Optional[str] = None, + auto_sync: Optional[bool] = None, + publish_runbook: Optional[bool] = None, + security_token: Optional["_models.SourceControlSecurityTokenProperties"] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Statistics(_Model): + """Definition of the statistic. + + :ivar counter_property: Gets the property value of the statistic. + :vartype counter_property: str + :ivar counter_value: Gets the value of the statistic. + :vartype counter_value: int + :ivar start_time: Gets the startTime of the statistic. + :vartype start_time: ~datetime.datetime + :ivar end_time: Gets the endTime of the statistic. + :vartype end_time: ~datetime.datetime + :ivar id: Gets the id. + :vartype id: str + """ + + counter_property: Optional[str] = rest_field(name="counterProperty", visibility=["read"]) + """Gets the property value of the statistic.""" + counter_value: Optional[int] = rest_field(name="counterValue", visibility=["read"]) + """Gets the value of the statistic.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Gets the startTime of the statistic.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """Gets the endTime of the statistic.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Gets the id.""" + + +class SUCScheduleProperties(_Model): + """Definition of schedule parameters. + + :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 + """ + + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the start time of the schedule.""" + start_time_offset_minutes: Optional[float] = rest_field(name="startTimeOffsetMinutes", visibility=["read"]) + """Gets the start time's offset in minutes.""" + expiry_time: Optional[datetime.datetime] = rest_field( + name="expiryTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the end time of the schedule.""" + expiry_time_offset_minutes: Optional[float] = rest_field( + name="expiryTimeOffsetMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the expiry time's offset in minutes.""" + is_enabled: Optional[bool] = rest_field( + name="isEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether this schedule is enabled.""" + next_run: Optional[datetime.datetime] = rest_field( + name="nextRun", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the next run time of the schedule.""" + next_run_offset_minutes: Optional[float] = rest_field( + name="nextRunOffsetMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the next run time's offset in minutes.""" + interval: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the interval of the schedule.""" + frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the frequency of the schedule. Known values are: \"OneTime\", \"Day\", \"Hour\", + \"Week\", \"Month\", and \"Minute\".""" + time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the time zone of the schedule.""" + advanced_schedule: Optional["_models.AdvancedSchedule"] = rest_field( + name="advancedSchedule", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the advanced schedule.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + + @overload + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + expiry_time: Optional[datetime.datetime] = None, + expiry_time_offset_minutes: Optional[float] = None, + is_enabled: Optional[bool] = None, + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_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 + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TagSettingsProperties(_Model): + """Tag filter information for the VM. + + :ivar tags: Dictionary of tags with its list of values. + :vartype tags: dict[str, list[str]] + :ivar filter_operator: Filter VMs by Any or All specified tags. Known values are: "All" and + "Any". + :vartype filter_operator: str or ~azure.mgmt.automation.models.TagOperators + """ + + tags: Optional[dict[str, list[str]]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Dictionary of tags with its list of values.""" + filter_operator: Optional[Union[str, "_models.TagOperators"]] = rest_field( + name="filterOperator", visibility=["read", "create", "update", "delete", "query"] + ) + """Filter VMs by Any or All specified tags. Known values are: \"All\" and \"Any\".""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, list[str]]] = None, + filter_operator: Optional[Union[str, "_models.TagOperators"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TargetProperties(_Model): + """Group specific to the update configuration. + + :ivar azure_queries: List of Azure queries in the software update configuration. + :vartype azure_queries: list[~azure.mgmt.automation.models.AzureQueryProperties] + :ivar non_azure_queries: List of non Azure queries in the software update configuration. + :vartype non_azure_queries: list[~azure.mgmt.automation.models.NonAzureQueryProperties] + """ + + azure_queries: Optional[list["_models.AzureQueryProperties"]] = rest_field( + name="azureQueries", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Azure queries in the software update configuration.""" + non_azure_queries: Optional[list["_models.NonAzureQueryProperties"]] = rest_field( + name="nonAzureQueries", visibility=["read", "create", "update", "delete", "query"] + ) + """List of non Azure queries in the software update configuration.""" + + @overload + def __init__( + self, + *, + azure_queries: Optional[list["_models.AzureQueryProperties"]] = None, + non_azure_queries: Optional[list["_models.NonAzureQueryProperties"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TaskProperties(_Model): + """Task properties of the software update configuration. + + :ivar parameters: Gets or sets the parameters of the task. + :vartype parameters: dict[str, str] + :ivar source: Gets or sets the name of the runbook. + :vartype source: str + """ + + parameters: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the parameters of the task.""" + source: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the runbook.""" + + @overload + def __init__( + self, + *, + parameters: Optional[dict[str, str]] = None, + source: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TestJob(_Model): + """Definition of the test job. + + :ivar creation_time: Gets or sets the creation time of the test job. + :vartype creation_time: ~datetime.datetime + :ivar status: Gets or sets the status of the test job. + :vartype status: str + :ivar status_details: Gets or sets the status details of the test job. + :vartype status_details: str + :ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be + executed. + :vartype run_on: str + :ivar start_time: Gets or sets the start time of the test job. + :vartype start_time: ~datetime.datetime + :ivar end_time: Gets or sets the end time of the test job. + :vartype end_time: ~datetime.datetime + :ivar exception: Gets or sets the exception of the test job. + :vartype exception: str + :ivar last_modified_time: Gets or sets the last modified time of the test job. + :vartype last_modified_time: ~datetime.datetime + :ivar last_status_modified_time: Gets or sets the last status modified time of the test job. + :vartype last_status_modified_time: ~datetime.datetime + :ivar parameters: Gets or sets the parameters of the test job. + :vartype parameters: dict[str, str] + :ivar log_activity_trace: The activity-level tracing options of the runbook. + :vartype log_activity_trace: int + """ + + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the creation time of the test job.""" + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the status of the test job.""" + status_details: Optional[str] = rest_field( + name="statusDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the status details of the test job.""" + run_on: Optional[str] = rest_field(name="runOn", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the runOn which specifies the group name where the job is to be executed.""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the start time of the test job.""" + end_time: Optional[datetime.datetime] = rest_field( + name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the end time of the test job.""" + exception: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the exception of the test job.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time of the test job.""" + last_status_modified_time: Optional[datetime.datetime] = rest_field( + name="lastStatusModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last status modified time of the test job.""" + parameters: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the parameters of the test job.""" + log_activity_trace: Optional[int] = rest_field( + name="logActivityTrace", visibility=["read", "create", "update", "delete", "query"] + ) + """The activity-level tracing options of the runbook.""" + + @overload + def __init__( + self, + *, + creation_time: Optional[datetime.datetime] = None, + status: Optional[str] = None, + status_details: Optional[str] = None, + run_on: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + 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, + log_activity_trace: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TestJobCreateParameters(_Model): + """The parameters supplied to the create test job operation. + + :ivar parameters: Gets or sets the parameters of the test job. + :vartype parameters: dict[str, str] + :ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be + executed. + :vartype run_on: str + :ivar runtime_environment: The runtime Environment Name on which job needs to be tested. + :vartype runtime_environment: str + """ + + parameters: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the parameters of the test job.""" + run_on: Optional[str] = rest_field(name="runOn", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the runOn which specifies the group name where the job is to be executed.""" + runtime_environment: Optional[str] = rest_field( + name="runtimeEnvironment", visibility=["read", "create", "update", "delete", "query"] + ) + """The runtime Environment Name on which job needs to be tested.""" + + @overload + def __init__( + self, + *, + parameters: Optional[dict[str, str]] = None, + run_on: Optional[str] = None, + runtime_environment: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TypeField(_Model): + """Information about a field of a type. + + :ivar name: Gets or sets the name of the field. + :vartype name: str + :ivar type: Gets or sets the type of the field. + :vartype type: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the field.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the type of the field.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UpdateConfiguration(_Model): + """Update specific properties of the software update configuration. + + :ivar operating_system: operating system of target machines. Required. Known values are: + "Windows" and "Linux". + :vartype operating_system: str or ~azure.mgmt.automation.models.OperatingSystemType + :ivar windows: Windows specific update configuration. + :vartype windows: ~azure.mgmt.automation.models.WindowsProperties + :ivar linux: Linux specific update configuration. + :vartype linux: ~azure.mgmt.automation.models.LinuxProperties + :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 + :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 non_azure_computer_names: List of names of non-azure machines targeted by the software + update configuration. + :vartype non_azure_computer_names: list[str] + :ivar targets: Group targets for the software update configuration. + :vartype targets: ~azure.mgmt.automation.models.TargetProperties + """ + + operating_system: Union[str, "_models.OperatingSystemType"] = rest_field( + name="operatingSystem", visibility=["read", "create", "update", "delete", "query"] + ) + """operating system of target machines. Required. Known values are: \"Windows\" and \"Linux\".""" + windows: Optional["_models.WindowsProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Windows specific update configuration.""" + linux: Optional["_models.LinuxProperties"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Linux specific update configuration.""" + duration: Optional[datetime.timedelta] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + azure_virtual_machines: Optional[list[str]] = rest_field( + name="azureVirtualMachines", visibility=["read", "create", "update", "delete", "query"] + ) + """List of azure resource Ids for azure virtual machines targeted by the software update + configuration.""" + non_azure_computer_names: Optional[list[str]] = rest_field( + name="nonAzureComputerNames", visibility=["read", "create", "update", "delete", "query"] + ) + """List of names of non-azure machines targeted by the software update configuration.""" + targets: Optional["_models.TargetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Group targets for the software update configuration.""" + + @overload + def __init__( + self, + *, + operating_system: Union[str, "_models.OperatingSystemType"], + 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, + targets: Optional["_models.TargetProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UpdateConfigurationMachineRunProperties(_Model): + """Software update configuration machine run properties. + + :ivar target_computer: name of the updated computer. + :vartype target_computer: str + :ivar target_computer_type: type of the updated computer. + :vartype target_computer_type: str + :ivar software_update_configuration: software update configuration triggered this run. + :vartype software_update_configuration: + ~azure.mgmt.automation.models.UpdateConfigurationNavigation + :ivar status: Status of the software update configuration machine run. + :vartype status: str + :ivar os_type: Operating system target of the software update configuration triggered this run. + :vartype os_type: str + :ivar correlation_id: correlation id of the software update configuration machine run. + :vartype correlation_id: str + :ivar source_computer_id: source computer id of the software update configuration machine run. + :vartype source_computer_id: str + :ivar start_time: Start time of the software update configuration machine run. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of the software update configuration machine run. + :vartype end_time: ~datetime.datetime + :ivar configured_duration: configured duration for the software update configuration run. + :vartype configured_duration: str + :ivar job: Job associated with the software update configuration machine run. + :vartype job: ~azure.mgmt.automation.models.JobNavigation + :ivar creation_time: Creation time of the resource, which only appears in the response. + :vartype creation_time: ~datetime.datetime + :ivar created_by: createdBy property, which only appears in the response. + :vartype created_by: str + :ivar last_modified_time: Last time resource was modified, which only appears in the response. + :vartype last_modified_time: ~datetime.datetime + :ivar last_modified_by: lastModifiedBy property, which only appears in the response. + :vartype last_modified_by: str + :ivar error: Details of provisioning error. + :vartype error: ~azure.mgmt.automation.models.AutomationErrorResponse + """ + + target_computer: Optional[str] = rest_field(name="targetComputer", visibility=["read"]) + """name of the updated computer.""" + target_computer_type: Optional[str] = rest_field(name="targetComputerType", visibility=["read"]) + """type of the updated computer.""" + software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = rest_field( + name="softwareUpdateConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """software update configuration triggered this run.""" + status: Optional[str] = rest_field(visibility=["read"]) + """Status of the software update configuration machine run.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read"]) + """Operating system target of the software update configuration triggered this run.""" + correlation_id: Optional[str] = rest_field(name="correlationId", visibility=["read"]) + """correlation id of the software update configuration machine run.""" + source_computer_id: Optional[str] = rest_field(name="sourceComputerId", visibility=["read"]) + """source computer id of the software update configuration machine run.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Start time of the software update configuration machine run.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """End time of the software update configuration machine run.""" + configured_duration: Optional[str] = rest_field(name="configuredDuration", visibility=["read"]) + """configured duration for the software update configuration run.""" + job: Optional["_models.JobNavigation"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Job associated with the software update configuration machine run.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Creation time of the resource, which only appears in the response.""" + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read"]) + """createdBy property, which only appears in the response.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read"], format="rfc3339" + ) + """Last time resource was modified, which only appears in the response.""" + last_modified_by: Optional[str] = rest_field(name="lastModifiedBy", visibility=["read"]) + """lastModifiedBy property, which only appears in the response.""" + error: Optional["_models.AutomationErrorResponse"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Details of provisioning error.""" + + @overload + def __init__( + self, + *, + software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = None, + job: Optional["_models.JobNavigation"] = None, + error: Optional["_models.AutomationErrorResponse"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UpdateConfigurationNavigation(_Model): + """Software update configuration Run Navigation model. + + :ivar name: Name of the software update configuration triggered the software update + configuration run. + :vartype name: str + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the software update configuration triggered the software update configuration run.""" + + +class Usage(_Model): + """Definition of Usage. + + :ivar id: Gets or sets the id of the resource. + :vartype id: str + :ivar name: Gets or sets the usage counter name. + :vartype name: ~azure.mgmt.automation.models.UsageCounterName + :ivar unit: Gets or sets the usage unit name. + :vartype unit: str + :ivar current_value: Gets or sets the current usage value. + :vartype current_value: float + :ivar limit: Gets or sets max limit. -1 for unlimited. + :vartype limit: int + :ivar throttle_status: Gets or sets the throttle status. + :vartype throttle_status: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the id of the resource.""" + name: Optional["_models.UsageCounterName"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the usage counter name.""" + unit: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the usage unit name.""" + current_value: Optional[float] = rest_field( + name="currentValue", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the current usage value.""" + limit: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets max limit. -1 for unlimited.""" + throttle_status: Optional[str] = rest_field( + name="throttleStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the throttle status.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional["_models.UsageCounterName"] = None, + unit: Optional[str] = None, + current_value: Optional[float] = None, + limit: Optional[int] = None, + throttle_status: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UsageCounterName(_Model): + """Definition of usage counter name. + + :ivar value: Gets or sets the usage counter name. + :vartype value: str + :ivar localized_value: Gets or sets the localized usage counter name. + :vartype localized_value: str + """ + + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the usage counter name.""" + localized_value: Optional[str] = rest_field( + name="localizedValue", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the localized usage counter name.""" + + @overload + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserAssignedIdentitiesProperties(_Model): + """UserAssignedIdentitiesProperties. + + :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 + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal id of user assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client id of user assigned identity.""" + + +class Variable(ProxyResource): + """Definition of the variable. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Gets or sets the properties of the variable. + :vartype properties: ~azure.mgmt.automation.models.VariableProperties + """ + + properties: Optional["_models.VariableProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the variable.""" + + __flattened_items = ["value", "is_encrypted", "creation_time", "last_modified_time", "description"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.VariableProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class VariableCreateOrUpdateParameters(_Model): + """The parameters supplied to the create or update variable operation. + + :ivar name: Gets or sets the name of the variable. Required. + :vartype name: str + :ivar properties: Gets or sets the properties of the variable. Required. + :vartype properties: ~azure.mgmt.automation.models.VariableCreateOrUpdateProperties + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the variable. Required.""" + properties: "_models.VariableCreateOrUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the variable. Required.""" + + __flattened_items = ["value", "description", "is_encrypted"] + + @overload + def __init__( + self, + *, + name: str, + properties: "_models.VariableCreateOrUpdateProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class VariableCreateOrUpdateProperties(_Model): + """The properties of the create variable operation. + + :ivar value: Gets or sets the value of the variable. + :vartype value: str + :ivar description: Gets or sets the description of the variable. + :vartype description: str + :ivar is_encrypted: Gets or sets the encrypted flag of the variable. + :vartype is_encrypted: bool + """ + + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the value of the variable.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the variable.""" + is_encrypted: Optional[bool] = rest_field( + name="isEncrypted", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the encrypted flag of the variable.""" + + @overload + def __init__( + self, + *, + value: Optional[str] = None, + description: Optional[str] = None, + is_encrypted: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VariableProperties(_Model): + """Definition of the variable properties. + + :ivar value: Gets or sets the value of the variable. + :vartype value: str + :ivar is_encrypted: Gets or sets the encrypted flag of the variable. + :vartype is_encrypted: bool + :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 + """ + + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the value of the variable.""" + is_encrypted: Optional[bool] = rest_field( + name="isEncrypted", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the encrypted flag of the variable.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + + @overload + def __init__( + self, + *, + value: Optional[str] = None, + is_encrypted: Optional[bool] = None, + creation_time: Optional[datetime.datetime] = None, + last_modified_time: Optional[datetime.datetime] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VariableUpdateParameters(_Model): + """The parameters supplied to the update variable operation. + + :ivar name: Gets or sets the name of the variable. + :vartype name: str + :ivar properties: Gets or sets the value of the variable. + :vartype properties: ~azure.mgmt.automation.models.VariableUpdateProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the variable.""" + properties: Optional["_models.VariableUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the value of the variable.""" + + __flattened_items = ["value", "description"] + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.VariableUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class VariableUpdateProperties(_Model): + """The properties of the update variable. + + :ivar value: Gets or sets the value of the variable. + :vartype value: str + :ivar description: Gets or sets the description of the variable. + :vartype description: str + """ + + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the value of the variable.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the variable.""" + + @overload + def __init__( + self, + *, + value: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Watcher(ProxyResource): + """Definition of the watcher type. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Gets or sets the watcher properties. + :vartype properties: ~azure.mgmt.automation.models.WatcherProperties + :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. + :vartype location: str + """ + + properties: Optional["_models.WatcherProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the watcher properties.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the etag of the resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update"]) + """Resource tags.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives.""" + + __flattened_items = [ + "execution_frequency_in_seconds", + "script_name", + "script_parameters", + "script_run_on", + "status", + "creation_time", + "last_modified_time", + "last_modified_by", + "description", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.WatcherProperties"] = None, + etag: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class WatcherProperties(_Model): + """Definition of the watcher properties. + + :ivar execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is + invoked. + :vartype execution_frequency_in_seconds: int + :ivar script_name: Gets or sets the name of the script the watcher is attached to, i.e. the + name of an existing runbook. + :vartype script_name: str + :ivar script_parameters: Gets or sets the parameters of the script. + :vartype script_parameters: dict[str, str] + :ivar script_run_on: Gets or sets the name of the hybrid worker group the watcher will run on. + :vartype script_run_on: str + :ivar status: Gets the current status of the watcher. + :vartype status: str + :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 last_modified_by: Details of the user who last modified the watcher. + :vartype last_modified_by: str + :ivar description: Gets or sets the description. + :vartype description: str + """ + + execution_frequency_in_seconds: Optional[int] = rest_field( + name="executionFrequencyInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the frequency at which the watcher is invoked.""" + script_name: Optional[str] = rest_field( + name="scriptName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the name of the script the watcher is attached to, i.e. the name of an existing + runbook.""" + script_parameters: Optional[dict[str, str]] = rest_field( + name="scriptParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the parameters of the script.""" + script_run_on: Optional[str] = rest_field( + name="scriptRunOn", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the name of the hybrid worker group the watcher will run on.""" + status: Optional[str] = rest_field(visibility=["read"]) + """Gets the current status of the watcher.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Gets or sets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read"], format="rfc3339" + ) + """Gets or sets the last modified time.""" + last_modified_by: Optional[str] = rest_field(name="lastModifiedBy", visibility=["read"]) + """Details of the user who last modified the watcher.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + + @overload + def __init__( + self, + *, + execution_frequency_in_seconds: Optional[int] = None, + script_name: Optional[str] = None, + script_parameters: Optional[dict[str, str]] = None, + script_run_on: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WatcherUpdateParameters(_Model): + """WatcherUpdateParameters. + + :ivar properties: Gets or sets the watcher update properties. + :vartype properties: ~azure.mgmt.automation.models.WatcherUpdateProperties + :ivar name: Gets or sets the name of the resource. + :vartype name: str + """ + + properties: Optional["_models.WatcherUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the watcher update properties.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the resource.""" + + __flattened_items = ["execution_frequency_in_seconds"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.WatcherUpdateProperties"] = None, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class WatcherUpdateProperties(_Model): + """The properties of the update watcher operation. + + :ivar execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is + invoked. + :vartype execution_frequency_in_seconds: int + """ + + execution_frequency_in_seconds: Optional[int] = rest_field( + name="executionFrequencyInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the frequency at which the watcher is invoked.""" + + @overload + def __init__( + self, + *, + execution_frequency_in_seconds: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Webhook(ProxyResource): + """Definition of the webhook type. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.automation.models.SystemData + :ivar properties: Gets or sets the webhook properties. + :vartype properties: ~azure.mgmt.automation.models.WebhookProperties + """ + + properties: Optional["_models.WebhookProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the webhook properties.""" + + __flattened_items = [ + "is_enabled", + "uri", + "expiry_time", + "last_invoked_time", + "parameters", + "runbook", + "run_on", + "creation_time", + "last_modified_time", + "last_modified_by", + "description", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.WebhookProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class WebhookCreateOrUpdateParameters(_Model): + """The parameters supplied to the create or update webhook operation. + + :ivar name: Gets or sets the name of the webhook. Required. + :vartype name: str + :ivar properties: Gets or sets the properties of the webhook. Required. + :vartype properties: ~azure.mgmt.automation.models.WebhookCreateOrUpdateProperties + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the webhook. Required.""" + properties: "_models.WebhookCreateOrUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the properties of the webhook. Required.""" + + __flattened_items = ["is_enabled", "uri", "expiry_time", "parameters", "runbook", "run_on"] + + @overload + def __init__( + self, + *, + name: str, + properties: "_models.WebhookCreateOrUpdateProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class WebhookCreateOrUpdateProperties(_Model): + """The properties of the create webhook operation. + + :ivar is_enabled: Gets or sets the value of the enabled flag of webhook. + :vartype is_enabled: bool + :ivar uri: Gets or sets the uri. + :vartype uri: str + :ivar expiry_time: Gets or sets the expiry time. + :vartype expiry_time: ~datetime.datetime + :ivar parameters: Gets or sets the parameters of the job. + :vartype parameters: dict[str, str] + :ivar runbook: Gets or sets the runbook. + :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty + :ivar run_on: Gets or sets the name of the hybrid worker group the webhook job will run on. + :vartype run_on: str + """ + + is_enabled: Optional[bool] = rest_field( + name="isEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the value of the enabled flag of webhook.""" + uri: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the uri.""" + expiry_time: Optional[datetime.datetime] = rest_field( + name="expiryTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the expiry time.""" + parameters: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the parameters of the job.""" + runbook: Optional["_models.RunbookAssociationProperty"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the runbook.""" + run_on: Optional[str] = rest_field(name="runOn", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the hybrid worker group the webhook job will run on.""" + + @overload + def __init__( + self, + *, + is_enabled: Optional[bool] = None, + uri: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + parameters: Optional[dict[str, str]] = None, + runbook: Optional["_models.RunbookAssociationProperty"] = None, + run_on: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebhookProperties(_Model): + """Definition of the webhook properties. + + :ivar is_enabled: Gets or sets the value of the enabled flag of the webhook. + :vartype is_enabled: bool + :ivar uri: Gets or sets the webhook uri. + :vartype uri: str + :ivar expiry_time: Gets or sets the expiry time. + :vartype expiry_time: ~datetime.datetime + :ivar last_invoked_time: Gets or sets the last invoked time. + :vartype last_invoked_time: ~datetime.datetime + :ivar parameters: Gets or sets the parameters of the job that is created when the webhook calls + the runbook it is associated with. + :vartype parameters: dict[str, str] + :ivar runbook: Gets or sets the runbook the webhook is associated with. + :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty + :ivar run_on: Gets or sets the name of the hybrid worker group the webhook job will run on. + :vartype run_on: str + :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 last_modified_by: Details of the user who last modified the Webhook. + :vartype last_modified_by: str + :ivar description: Gets or sets the description. + :vartype description: str + """ + + is_enabled: Optional[bool] = rest_field( + name="isEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the value of the enabled flag of the webhook.""" + uri: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the webhook uri.""" + expiry_time: Optional[datetime.datetime] = rest_field( + name="expiryTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the expiry time.""" + last_invoked_time: Optional[datetime.datetime] = rest_field( + name="lastInvokedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last invoked time.""" + parameters: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the parameters of the job that is created when the webhook calls the runbook it is + associated with.""" + runbook: Optional["_models.RunbookAssociationProperty"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the runbook the webhook is associated with.""" + run_on: Optional[str] = rest_field(name="runOn", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the hybrid worker group the webhook job will run on.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the creation time.""" + last_modified_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Gets or sets the last modified time.""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """Details of the user who last modified the Webhook.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description.""" + + @overload + def __init__( + self, + *, + is_enabled: Optional[bool] = None, + uri: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + last_invoked_time: Optional[datetime.datetime] = None, + parameters: Optional[dict[str, str]] = None, + runbook: Optional["_models.RunbookAssociationProperty"] = None, + run_on: Optional[str] = None, + creation_time: Optional[datetime.datetime] = None, + last_modified_time: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebhookUpdateParameters(_Model): + """The parameters supplied to the update webhook operation. + + :ivar name: Gets or sets the name of the webhook. + :vartype name: str + :ivar properties: Gets or sets the value of the webhook. + :vartype properties: ~azure.mgmt.automation.models.WebhookUpdateProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the webhook.""" + properties: Optional["_models.WebhookUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the value of the webhook.""" + + __flattened_items = ["is_enabled", "run_on", "parameters", "description"] + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.WebhookUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class WebhookUpdateProperties(_Model): + """The properties of the update webhook. + + :ivar is_enabled: Gets or sets the value of the enabled flag of webhook. + :vartype is_enabled: bool + :ivar run_on: Gets or sets the name of the hybrid worker group the webhook job will run on. + :vartype run_on: str + :ivar parameters: Gets or sets the parameters of the job. + :vartype parameters: dict[str, str] + :ivar description: Gets or sets the description of the webhook. + :vartype description: str + """ + + is_enabled: Optional[bool] = rest_field( + name="isEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the value of the enabled flag of webhook.""" + run_on: Optional[str] = rest_field(name="runOn", visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the name of the hybrid worker group the webhook job will run on.""" + parameters: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the parameters of the job.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the description of the webhook.""" + + @overload + def __init__( + self, + *, + is_enabled: Optional[bool] = None, + run_on: Optional[str] = None, + parameters: Optional[dict[str, str]] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WindowsProperties(_Model): + """Windows specific update configuration. + + :ivar included_update_classifications: Update classification included in the software update + configuration. A comma separated string with required values. Known values are: "Unclassified", + "Critical", "Security", "UpdateRollup", "FeaturePack", "ServicePack", "Definition", "Tools", + and "Updates". + :vartype included_update_classifications: str or + ~azure.mgmt.automation.models.WindowsUpdateClasses + :ivar excluded_kb_numbers: KB numbers excluded from the software update configuration. + :vartype excluded_kb_numbers: list[str] + :ivar included_kb_numbers: KB numbers included from the software update configuration. + :vartype included_kb_numbers: list[str] + :ivar reboot_setting: Reboot setting for the software update configuration. + :vartype reboot_setting: str + """ + + included_update_classifications: Optional[Union[str, "_models.WindowsUpdateClasses"]] = rest_field( + name="includedUpdateClassifications", visibility=["read", "create", "update", "delete", "query"] + ) + """Update classification included in the software update configuration. A comma separated string + with required values. Known values are: \"Unclassified\", \"Critical\", \"Security\", + \"UpdateRollup\", \"FeaturePack\", \"ServicePack\", \"Definition\", \"Tools\", and \"Updates\".""" + excluded_kb_numbers: Optional[list[str]] = rest_field( + name="excludedKbNumbers", visibility=["read", "create", "update", "delete", "query"] + ) + """KB numbers excluded from the software update configuration.""" + included_kb_numbers: Optional[list[str]] = rest_field( + name="includedKbNumbers", visibility=["read", "create", "update", "delete", "query"] + ) + """KB numbers included from the software update configuration.""" + reboot_setting: Optional[str] = rest_field( + name="rebootSetting", visibility=["read", "create", "update", "delete", "query"] + ) + """Reboot setting for the software update configuration.""" + + @overload + 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, + reboot_setting: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) 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 deleted file mode 100644 index f8f8cbb60d22..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models_py3.py +++ /dev/null @@ -1,8201 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -import datetime -from typing import Any, Literal, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class Activity(_serialization.Model): - """Definition of the activity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Gets or sets the id of the resource. - :vartype id: str - :ivar name: Gets the name of the activity. - :vartype name: str - :ivar definition: Gets or sets the user name of the activity. - :vartype definition: str - :ivar parameter_sets: Gets or sets the parameter sets of the activity. - :vartype parameter_sets: list[~azure.mgmt.automation.models.ActivityParameterSet] - :ivar output_types: Gets or sets the output types of the activity. - :vartype output_types: list[~azure.mgmt.automation.models.ActivityOutputType] - :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 = { - "name": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "definition": {"key": "properties.definition", "type": "str"}, - "parameter_sets": {"key": "properties.parameterSets", "type": "[ActivityParameterSet]"}, - "output_types": {"key": "properties.outputTypes", "type": "[ActivityOutputType]"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, - *, - 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, - creation_time: Optional[datetime.datetime] = None, - last_modified_time: Optional[datetime.datetime] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Gets or sets the id of the resource. - :paramtype id: str - :keyword definition: Gets or sets the user name of the activity. - :paramtype definition: str - :keyword parameter_sets: Gets or sets the parameter sets of the activity. - :paramtype parameter_sets: list[~azure.mgmt.automation.models.ActivityParameterSet] - :keyword output_types: Gets or sets the output types of the activity. - :paramtype output_types: list[~azure.mgmt.automation.models.ActivityOutputType] - :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.id = id - self.name: Optional[str] = None - self.definition = definition - self.parameter_sets = parameter_sets - self.output_types = output_types - self.creation_time = creation_time - self.last_modified_time = last_modified_time - self.description = description - - -class ActivityListResult(_serialization.Model): - """The response model for the list activity operation. - - :ivar value: Gets or sets a list of activities. - :vartype value: list[~azure.mgmt.automation.models.Activity] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Activity]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Activity"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of activities. - :paramtype value: list[~azure.mgmt.automation.models.Activity] - :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 ActivityOutputType(_serialization.Model): - """Definition of the activity output type. - - :ivar name: Gets or sets the name of the activity output type. - :vartype name: str - :ivar type: Gets or sets the type of the activity output type. - :vartype type: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Gets or sets the name of the activity output type. - :paramtype name: str - :keyword type: Gets or sets the type of the activity output type. - :paramtype type: str - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - -class ActivityParameter(_serialization.Model): - """Definition of the activity parameter. - - :ivar name: Gets or sets the name of the activity parameter. - :vartype name: str - :ivar type: Gets or sets the type of the activity parameter. - :vartype type: str - :ivar is_mandatory: Gets or sets a Boolean value that indicates true if the parameter is - required. If the value is false, the parameter is optional. - :vartype is_mandatory: bool - :ivar is_dynamic: Gets or sets a Boolean value that indicates true if the parameter is dynamic. - :vartype is_dynamic: bool - :ivar position: Gets or sets the position of the activity parameter. - :vartype position: int - :ivar value_from_pipeline: Gets or sets a Boolean value that indicates true if the parameter - can take values from the incoming pipeline objects. This setting is used if the cmdlet must - access the complete input object. false indicates that the parameter cannot take values from - the complete input object. - :vartype value_from_pipeline: bool - :ivar value_from_pipeline_by_property_name: Gets or sets a Boolean value that indicates true if - the parameter can be filled from a property of the incoming pipeline object that has the same - name as this parameter. false indicates that the parameter cannot be filled from the incoming - pipeline object property with the same name. - :vartype value_from_pipeline_by_property_name: bool - :ivar value_from_remaining_arguments: Gets or sets a Boolean value that indicates true if the - cmdlet parameter accepts all the remaining command-line arguments that are associated with this - parameter in the form of an array. false if the cmdlet parameter does not accept all the - remaining argument values. - :vartype value_from_remaining_arguments: bool - :ivar description: Gets or sets the description of the activity parameter. - :vartype description: str - :ivar validation_set: Gets or sets the validation set of activity parameter. - :vartype validation_set: list[~azure.mgmt.automation.models.ActivityParameterValidationSet] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "is_mandatory": {"key": "isMandatory", "type": "bool"}, - "is_dynamic": {"key": "isDynamic", "type": "bool"}, - "position": {"key": "position", "type": "int"}, - "value_from_pipeline": {"key": "valueFromPipeline", "type": "bool"}, - "value_from_pipeline_by_property_name": {"key": "valueFromPipelineByPropertyName", "type": "bool"}, - "value_from_remaining_arguments": {"key": "valueFromRemainingArguments", "type": "bool"}, - "description": {"key": "description", "type": "str"}, - "validation_set": {"key": "validationSet", "type": "[ActivityParameterValidationSet]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - type: Optional[str] = None, - is_mandatory: Optional[bool] = None, - is_dynamic: Optional[bool] = None, - position: Optional[int] = None, - value_from_pipeline: Optional[bool] = None, - 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, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the activity parameter. - :paramtype name: str - :keyword type: Gets or sets the type of the activity parameter. - :paramtype type: str - :keyword is_mandatory: Gets or sets a Boolean value that indicates true if the parameter is - required. If the value is false, the parameter is optional. - :paramtype is_mandatory: bool - :keyword is_dynamic: Gets or sets a Boolean value that indicates true if the parameter is - dynamic. - :paramtype is_dynamic: bool - :keyword position: Gets or sets the position of the activity parameter. - :paramtype position: int - :keyword value_from_pipeline: Gets or sets a Boolean value that indicates true if the parameter - can take values from the incoming pipeline objects. This setting is used if the cmdlet must - access the complete input object. false indicates that the parameter cannot take values from - the complete input object. - :paramtype value_from_pipeline: bool - :keyword value_from_pipeline_by_property_name: Gets or sets a Boolean value that indicates true - if the parameter can be filled from a property of the incoming pipeline object that has the - same name as this parameter. false indicates that the parameter cannot be filled from the - incoming pipeline object property with the same name. - :paramtype value_from_pipeline_by_property_name: bool - :keyword value_from_remaining_arguments: Gets or sets a Boolean value that indicates true if - the cmdlet parameter accepts all the remaining command-line arguments that are associated with - this parameter in the form of an array. false if the cmdlet parameter does not accept all the - remaining argument values. - :paramtype value_from_remaining_arguments: bool - :keyword description: Gets or sets the description of the activity parameter. - :paramtype description: str - :keyword validation_set: Gets or sets the validation set of activity parameter. - :paramtype validation_set: list[~azure.mgmt.automation.models.ActivityParameterValidationSet] - """ - super().__init__(**kwargs) - self.name = name - self.type = type - self.is_mandatory = is_mandatory - self.is_dynamic = is_dynamic - self.position = position - self.value_from_pipeline = value_from_pipeline - self.value_from_pipeline_by_property_name = value_from_pipeline_by_property_name - self.value_from_remaining_arguments = value_from_remaining_arguments - self.description = description - self.validation_set = validation_set - - -class ActivityParameterSet(_serialization.Model): - """Definition of the activity parameter set. - - :ivar name: Gets or sets the name of the activity parameter set. - :vartype name: str - :ivar parameters: Gets or sets the parameters of the activity parameter set. - :vartype parameters: list[~azure.mgmt.automation.models.ActivityParameter] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "parameters": {"key": "parameters", "type": "[ActivityParameter]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - parameters: Optional[list["_models.ActivityParameter"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the activity parameter set. - :paramtype name: str - :keyword parameters: Gets or sets the parameters of the activity parameter set. - :paramtype parameters: list[~azure.mgmt.automation.models.ActivityParameter] - """ - super().__init__(**kwargs) - self.name = name - self.parameters = parameters - - -class ActivityParameterValidationSet(_serialization.Model): - """Definition of the activity parameter validation set. - - :ivar member_value: Gets or sets the name of the activity parameter validation set member. - :vartype member_value: str - """ - - _attribute_map = { - "member_value": {"key": "memberValue", "type": "str"}, - } - - def __init__(self, *, member_value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword member_value: Gets or sets the name of the activity parameter validation set member. - :paramtype member_value: str - """ - super().__init__(**kwargs) - self.member_value = member_value - - -class AdvancedSchedule(_serialization.Model): - """The properties of the create Advanced Schedule. - - :ivar week_days: Days of the week that the job should execute on. - :vartype week_days: list[str] - :ivar month_days: Days of the month that the job should execute on. Must be between 1 and 31. - :vartype month_days: list[int] - :ivar monthly_occurrences: Occurrences of days within a month. - :vartype monthly_occurrences: - list[~azure.mgmt.automation.models.AdvancedScheduleMonthlyOccurrence] - """ - - _attribute_map = { - "week_days": {"key": "weekDays", "type": "[str]"}, - "month_days": {"key": "monthDays", "type": "[int]"}, - "monthly_occurrences": {"key": "monthlyOccurrences", "type": "[AdvancedScheduleMonthlyOccurrence]"}, - } - - def __init__( - self, - *, - week_days: Optional[list[str]] = None, - month_days: Optional[list[int]] = None, - monthly_occurrences: Optional[list["_models.AdvancedScheduleMonthlyOccurrence"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword week_days: Days of the week that the job should execute on. - :paramtype week_days: list[str] - :keyword month_days: Days of the month that the job should execute on. Must be between 1 and - 31. - :paramtype month_days: list[int] - :keyword monthly_occurrences: Occurrences of days within a month. - :paramtype monthly_occurrences: - list[~azure.mgmt.automation.models.AdvancedScheduleMonthlyOccurrence] - """ - super().__init__(**kwargs) - self.week_days = week_days - self.month_days = month_days - self.monthly_occurrences = monthly_occurrences - - -class AdvancedScheduleMonthlyOccurrence(_serialization.Model): - """The properties of the create advanced schedule monthly occurrence. - - :ivar occurrence: Occurrence of the week within the month. Must be between 1 and 5. - :vartype occurrence: int - :ivar day: Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday, - saturday, sunday. Known values are: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", - "Saturday", and "Sunday". - :vartype day: str or ~azure.mgmt.automation.models.ScheduleDay - """ - - _attribute_map = { - "occurrence": {"key": "occurrence", "type": "int"}, - "day": {"key": "day", "type": "str"}, - } - - def __init__( - self, - *, - occurrence: Optional[int] = None, - day: Optional[Union[str, "_models.ScheduleDay"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword occurrence: Occurrence of the week within the month. Must be between 1 and 5. - :paramtype occurrence: int - :keyword day: Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, - friday, saturday, sunday. Known values are: "Monday", "Tuesday", "Wednesday", "Thursday", - "Friday", "Saturday", and "Sunday". - :paramtype day: str or ~azure.mgmt.automation.models.ScheduleDay - """ - super().__init__(**kwargs) - self.occurrence = occurrence - self.day = day - - -class AgentRegistration(_serialization.Model): - """Definition of the agent registration information type. - - :ivar dsc_meta_configuration: Gets or sets the dsc meta configuration. - :vartype dsc_meta_configuration: str - :ivar endpoint: Gets or sets the dsc server endpoint. - :vartype endpoint: str - :ivar keys: Gets or sets the agent registration keys. - :vartype keys: ~azure.mgmt.automation.models.AgentRegistrationKeys - :ivar id: Gets or sets the id. - :vartype id: str - """ - - _attribute_map = { - "dsc_meta_configuration": {"key": "dscMetaConfiguration", "type": "str"}, - "endpoint": {"key": "endpoint", "type": "str"}, - "keys": {"key": "keys", "type": "AgentRegistrationKeys"}, - "id": {"key": "id", "type": "str"}, - } - - def __init__( - self, - *, - dsc_meta_configuration: Optional[str] = None, - endpoint: Optional[str] = None, - keys: Optional["_models.AgentRegistrationKeys"] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs: Any - ) -> None: - """ - :keyword dsc_meta_configuration: Gets or sets the dsc meta configuration. - :paramtype dsc_meta_configuration: str - :keyword endpoint: Gets or sets the dsc server endpoint. - :paramtype endpoint: str - :keyword keys: Gets or sets the agent registration keys. - :paramtype keys: ~azure.mgmt.automation.models.AgentRegistrationKeys - :keyword id: Gets or sets the id. - :paramtype id: str - """ - super().__init__(**kwargs) - self.dsc_meta_configuration = dsc_meta_configuration - self.endpoint = endpoint - self.keys = keys - self.id = id - - -class AgentRegistrationKeys(_serialization.Model): - """Definition of the agent registration keys. - - :ivar primary: Gets or sets the primary key. - :vartype primary: str - :ivar secondary: Gets or sets the secondary key. - :vartype secondary: str - """ - - _attribute_map = { - "primary": {"key": "primary", "type": "str"}, - "secondary": {"key": "secondary", "type": "str"}, - } - - def __init__(self, *, primary: Optional[str] = None, secondary: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword primary: Gets or sets the primary key. - :paramtype primary: str - :keyword secondary: Gets or sets the secondary key. - :paramtype secondary: str - """ - super().__init__(**kwargs) - self.primary = primary - self.secondary = secondary - - -class AgentRegistrationRegenerateKeyParameter(_serialization.Model): - """The parameters supplied to the regenerate keys operation. - - All required parameters must be populated in order to send to server. - - :ivar key_name: Gets or sets the agent registration key name - primary or secondary. Required. - Known values are: "primary" and "secondary". - :vartype key_name: str or ~azure.mgmt.automation.models.AgentRegistrationKeyName - """ - - _validation = { - "key_name": {"required": True}, - } - - _attribute_map = { - "key_name": {"key": "keyName", "type": "str"}, - } - - def __init__(self, *, key_name: Union[str, "_models.AgentRegistrationKeyName"], **kwargs: Any) -> None: - """ - :keyword key_name: Gets or sets the agent registration key name - primary or secondary. - Required. Known values are: "primary" and "secondary". - :paramtype key_name: str or ~azure.mgmt.automation.models.AgentRegistrationKeyName - """ - super().__init__(**kwargs) - self.key_name = key_name - - -class Resource(_serialization.Model): - """The core properties of ARM resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - - -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The Azure Region where the resource lives. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - 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] - :keyword location: The Azure Region where the resource lives. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class AutomationAccount(TrackedResource): - """Definition of the automation account type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The Azure Region where the resource lives. - :vartype location: str - :ivar etag: Gets or sets the etag of the resource. - :vartype etag: str - :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. - :vartype last_modified_by: str - :ivar state: Gets status of account. Known values are: "Ok", "Unavailable", and "Suspended". - :vartype state: str or ~azure.mgmt.automation.models.AutomationAccountState - :ivar creation_time: Gets the creation time. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Gets the last modified time. - :vartype last_modified_time: ~datetime.datetime - :ivar description: Gets or sets the description. - :vartype description: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "state": {"readonly": True}, - "creation_time": {"readonly": True}, - "last_modified_time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "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"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - location: Optional[str] = None, - etag: Optional[str] = None, - sku: Optional["_models.Sku"] = None, - last_modified_by: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The Azure Region where the resource lives. - :paramtype location: str - :keyword etag: Gets or sets the etag of the resource. - :paramtype etag: str - :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 - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag = etag - self.sku = sku - self.last_modified_by = last_modified_by - 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 - - -class AutomationAccountCreateOrUpdateParameters(_serialization.Model): # pylint: disable=name-too-long - """The parameters supplied to the create or update automation account operation. - - :ivar name: Gets or sets name of the resource. - :vartype name: str - :ivar location: Gets or sets the location of the resource. - :vartype location: str - :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 - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "properties.sku", "type": "Sku"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets name of the resource. - :paramtype name: str - :keyword location: Gets or sets the location of the resource. - :paramtype location: str - :keyword tags: Gets or sets the tags attached to the resource. - :paramtype tags: dict[str, str] - :keyword sku: Gets or sets account SKU. - :paramtype sku: ~azure.mgmt.automation.models.Sku - """ - super().__init__(**kwargs) - self.name = name - self.location = location - self.tags = tags - self.sku = sku - - -class AutomationAccountListResult(_serialization.Model): - """The response model for the list account operation. - - :ivar value: Gets or sets list of accounts. - :vartype value: list[~azure.mgmt.automation.models.AutomationAccount] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AutomationAccount]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.AutomationAccount"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets list of accounts. - :paramtype value: list[~azure.mgmt.automation.models.AutomationAccount] - :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 AutomationAccountUpdateParameters(_serialization.Model): - """The parameters supplied to the update automation account operation. - - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar location: Gets or sets the location of the resource. - :vartype location: str - :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 - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "properties.sku", "type": "Sku"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the resource. - :paramtype name: str - :keyword location: Gets or sets the location of the resource. - :paramtype location: str - :keyword tags: Gets or sets the tags attached to the resource. - :paramtype tags: dict[str, str] - :keyword sku: Gets or sets account SKU. - :paramtype sku: ~azure.mgmt.automation.models.Sku - """ - super().__init__(**kwargs) - self.name = name - self.location = location - self.tags = tags - self.sku = sku - - -class AzureQueryProperties(_serialization.Model): - """Azure query for the update configuration. - - :ivar scope: List of Subscription or Resource Group ARM Ids. - :vartype scope: list[str] - :ivar locations: List of locations to scope the query to. - :vartype locations: list[str] - :ivar tag_settings: Tag settings for the VM. - :vartype tag_settings: ~azure.mgmt.automation.models.TagSettingsProperties - """ - - _attribute_map = { - "scope": {"key": "scope", "type": "[str]"}, - "locations": {"key": "locations", "type": "[str]"}, - "tag_settings": {"key": "tagSettings", "type": "TagSettingsProperties"}, - } - - def __init__( - self, - *, - scope: Optional[list[str]] = None, - locations: Optional[list[str]] = None, - tag_settings: Optional["_models.TagSettingsProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword scope: List of Subscription or Resource Group ARM Ids. - :paramtype scope: list[str] - :keyword locations: List of locations to scope the query to. - :paramtype locations: list[str] - :keyword tag_settings: Tag settings for the VM. - :paramtype tag_settings: ~azure.mgmt.automation.models.TagSettingsProperties - """ - super().__init__(**kwargs) - self.scope = scope - self.locations = locations - self.tag_settings = tag_settings - - -class ProxyResource(Resource): - """ARM proxy 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 - """ - - -class Certificate(ProxyResource): - """Definition of the certificate. - - 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 thumbprint: Gets the thumbprint of the certificate. - :vartype thumbprint: str - :ivar expiry_time: Gets the expiry time of the certificate. - :vartype expiry_time: ~datetime.datetime - :ivar is_exportable: Gets the is exportable flag of the certificate. - :vartype is_exportable: bool - :ivar creation_time: Gets the creation time. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Gets the last modified time. - :vartype last_modified_time: ~datetime.datetime - :ivar description: Gets or sets the description. - :vartype description: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "thumbprint": {"readonly": True}, - "expiry_time": {"readonly": True}, - "is_exportable": {"readonly": True}, - "creation_time": {"readonly": True}, - "last_modified_time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "thumbprint": {"key": "properties.thumbprint", "type": "str"}, - "expiry_time": {"key": "properties.expiryTime", "type": "iso-8601"}, - "is_exportable": {"key": "properties.isExportable", "type": "bool"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword description: Gets or sets the description. - :paramtype description: str - """ - super().__init__(**kwargs) - 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 - - -class CertificateCreateOrUpdateParameters(_serialization.Model): - """The parameters supplied to the create or update or replace certificate operation. - - All required parameters must be populated in order to send to server. - - :ivar name: Gets or sets the name of the certificate. Required. - :vartype name: str - :ivar base64_value: Gets or sets the base64 encoded value of the certificate. Required. - :vartype base64_value: str - :ivar description: Gets or sets the description of the certificate. - :vartype description: str - :ivar thumbprint: Gets or sets the thumbprint of the certificate. - :vartype thumbprint: str - :ivar is_exportable: Gets or sets the is exportable flag of the certificate. - :vartype is_exportable: bool - """ - - _validation = { - "name": {"required": True}, - "base64_value": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "base64_value": {"key": "properties.base64Value", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "thumbprint": {"key": "properties.thumbprint", "type": "str"}, - "is_exportable": {"key": "properties.isExportable", "type": "bool"}, - } - - def __init__( - self, - *, - name: str, - base64_value: str, - description: Optional[str] = None, - thumbprint: Optional[str] = None, - is_exportable: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the certificate. Required. - :paramtype name: str - :keyword base64_value: Gets or sets the base64 encoded value of the certificate. Required. - :paramtype base64_value: str - :keyword description: Gets or sets the description of the certificate. - :paramtype description: str - :keyword thumbprint: Gets or sets the thumbprint of the certificate. - :paramtype thumbprint: str - :keyword is_exportable: Gets or sets the is exportable flag of the certificate. - :paramtype is_exportable: bool - """ - super().__init__(**kwargs) - self.name = name - self.base64_value = base64_value - self.description = description - self.thumbprint = thumbprint - self.is_exportable = is_exportable - - -class CertificateListResult(_serialization.Model): - """The response model for the list certificate operation. - - :ivar value: Gets or sets a list of certificates. - :vartype value: list[~azure.mgmt.automation.models.Certificate] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Certificate]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Certificate"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of certificates. - :paramtype value: list[~azure.mgmt.automation.models.Certificate] - :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 CertificateUpdateParameters(_serialization.Model): - """The parameters supplied to the update certificate operation. - - :ivar name: Gets or sets the name of the certificate. - :vartype name: str - :ivar description: Gets or sets the description of the certificate. - :vartype description: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Gets or sets the name of the certificate. - :paramtype name: str - :keyword description: Gets or sets the description of the certificate. - :paramtype description: str - """ - super().__init__(**kwargs) - self.name = name - 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. - - 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 connection_type: Gets or sets the connectionType of the connection. - :vartype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty - :ivar field_definition_values: Gets the field definition values of the connection. - :vartype field_definition_values: dict[str, str] - :ivar creation_time: Gets the creation time. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Gets the last modified time. - :vartype last_modified_time: ~datetime.datetime - :ivar description: Gets or sets the description. - :vartype description: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "field_definition_values": {"readonly": True}, - "creation_time": {"readonly": True}, - "last_modified_time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "connection_type": {"key": "properties.connectionType", "type": "ConnectionTypeAssociationProperty"}, - "field_definition_values": {"key": "properties.fieldDefinitionValues", "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"}, - } - - def __init__( - self, - *, - connection_type: Optional["_models.ConnectionTypeAssociationProperty"] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword connection_type: Gets or sets the connectionType of the connection. - :paramtype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty - :keyword description: Gets or sets the description. - :paramtype description: str - """ - super().__init__(**kwargs) - self.connection_type = connection_type - 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 - - -class ConnectionCreateOrUpdateParameters(_serialization.Model): - """The parameters supplied to the create or update connection operation. - - All required parameters must be populated in order to send to server. - - :ivar name: Gets or sets the name of the connection. Required. - :vartype name: str - :ivar description: Gets or sets the description of the connection. - :vartype description: str - :ivar connection_type: Gets or sets the connectionType of the connection. Required. - :vartype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty - :ivar field_definition_values: Gets or sets the field definition properties of the connection. - :vartype field_definition_values: dict[str, str] - """ - - _validation = { - "name": {"required": True}, - "connection_type": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "connection_type": {"key": "properties.connectionType", "type": "ConnectionTypeAssociationProperty"}, - "field_definition_values": {"key": "properties.fieldDefinitionValues", "type": "{str}"}, - } - - def __init__( - self, - *, - name: str, - connection_type: "_models.ConnectionTypeAssociationProperty", - description: Optional[str] = None, - field_definition_values: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the connection. Required. - :paramtype name: str - :keyword description: Gets or sets the description of the connection. - :paramtype description: str - :keyword connection_type: Gets or sets the connectionType of the connection. Required. - :paramtype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty - :keyword field_definition_values: Gets or sets the field definition properties of the - connection. - :paramtype field_definition_values: dict[str, str] - """ - super().__init__(**kwargs) - self.name = name - self.description = description - self.connection_type = connection_type - self.field_definition_values = field_definition_values - - -class ConnectionListResult(_serialization.Model): - """The response model for the list connection operation. - - :ivar value: Gets or sets a list of connection. - :vartype value: list[~azure.mgmt.automation.models.Connection] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Connection]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Connection"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of connection. - :paramtype value: list[~azure.mgmt.automation.models.Connection] - :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 ConnectionType(_serialization.Model): - """Definition of the connection type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Gets the id of the resource. - :vartype id: str - :ivar name: Gets the name of the connection type. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar is_global: Gets or sets a Boolean value to indicate if the connection type is global. - :vartype is_global: bool - :ivar field_definitions: Gets the field definitions of the connection type. - :vartype field_definitions: dict[str, ~azure.mgmt.automation.models.FieldDefinition] - :ivar creation_time: Gets 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 = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "field_definitions": {"readonly": True}, - "creation_time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "is_global": {"key": "properties.isGlobal", "type": "bool"}, - "field_definitions": {"key": "properties.fieldDefinitions", "type": "{FieldDefinition}"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, - *, - is_global: Optional[bool] = None, - last_modified_time: Optional[datetime.datetime] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword is_global: Gets or sets a Boolean value to indicate if the connection type is global. - :paramtype is_global: bool - :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.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.is_global = is_global - 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 - - -class ConnectionTypeAssociationProperty(_serialization.Model): - """The connection type property associated with the entity. - - :ivar name: Gets or sets the name of the connection type. - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Gets or sets the name of the connection type. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class ConnectionTypeCreateOrUpdateParameters(_serialization.Model): - """The parameters supplied to the create or update connection type operation. - - All required parameters must be populated in order to send to server. - - :ivar name: Gets or sets the name of the connection type. Required. - :vartype name: str - :ivar is_global: Gets or sets a Boolean value to indicate if the connection type is global. - :vartype is_global: bool - :ivar field_definitions: Gets or sets the field definitions of the connection type. Required. - :vartype field_definitions: dict[str, ~azure.mgmt.automation.models.FieldDefinition] - """ - - _validation = { - "name": {"required": True}, - "field_definitions": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_global": {"key": "properties.isGlobal", "type": "bool"}, - "field_definitions": {"key": "properties.fieldDefinitions", "type": "{FieldDefinition}"}, - } - - def __init__( - self, - *, - name: str, - field_definitions: dict[str, "_models.FieldDefinition"], - is_global: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the connection type. Required. - :paramtype name: str - :keyword is_global: Gets or sets a Boolean value to indicate if the connection type is global. - :paramtype is_global: bool - :keyword field_definitions: Gets or sets the field definitions of the connection type. - Required. - :paramtype field_definitions: dict[str, ~azure.mgmt.automation.models.FieldDefinition] - """ - super().__init__(**kwargs) - self.name = name - self.is_global = is_global - self.field_definitions = field_definitions - - -class ConnectionTypeListResult(_serialization.Model): - """The response model for the list connection type operation. - - :ivar value: Gets or sets a list of connection types. - :vartype value: list[~azure.mgmt.automation.models.ConnectionType] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ConnectionType]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.ConnectionType"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of connection types. - :paramtype value: list[~azure.mgmt.automation.models.ConnectionType] - :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 ConnectionUpdateParameters(_serialization.Model): - """The parameters supplied to the update connection operation. - - :ivar name: Gets or sets the name of the connection. - :vartype name: str - :ivar description: Gets or sets the description of the connection. - :vartype description: str - :ivar field_definition_values: Gets or sets the field definition values of the connection. - :vartype field_definition_values: dict[str, str] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "field_definition_values": {"key": "properties.fieldDefinitionValues", "type": "{str}"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - description: Optional[str] = None, - field_definition_values: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the connection. - :paramtype name: str - :keyword description: Gets or sets the description of the connection. - :paramtype description: str - :keyword field_definition_values: Gets or sets the field definition values of the connection. - :paramtype field_definition_values: dict[str, str] - """ - super().__init__(**kwargs) - self.name = name - self.description = description - self.field_definition_values = field_definition_values - - -class ContentHash(_serialization.Model): - """Definition of the runbook property type. - - All required parameters must be populated in order to send to server. - - :ivar algorithm: Gets or sets the content hash algorithm used to hash the content. Required. - :vartype algorithm: str - :ivar value: Gets or sets expected hash value of the content. Required. - :vartype value: str - """ - - _validation = { - "algorithm": {"required": True}, - "value": {"required": True}, - } - - _attribute_map = { - "algorithm": {"key": "algorithm", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, algorithm: str, value: str, **kwargs: Any) -> None: - """ - :keyword algorithm: Gets or sets the content hash algorithm used to hash the content. Required. - :paramtype algorithm: str - :keyword value: Gets or sets expected hash value of the content. Required. - :paramtype value: str - """ - super().__init__(**kwargs) - self.algorithm = algorithm - self.value = value - - -class ContentLink(_serialization.Model): - """Definition of the content link. - - :ivar uri: Gets or sets the uri of the runbook content. - :vartype uri: str - :ivar content_hash: Gets or sets the hash. - :vartype content_hash: ~azure.mgmt.automation.models.ContentHash - :ivar version: Gets or sets the version of the content. - :vartype version: str - """ - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - "content_hash": {"key": "contentHash", "type": "ContentHash"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, - *, - uri: Optional[str] = None, - content_hash: Optional["_models.ContentHash"] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword uri: Gets or sets the uri of the runbook content. - :paramtype uri: str - :keyword content_hash: Gets or sets the hash. - :paramtype content_hash: ~azure.mgmt.automation.models.ContentHash - :keyword version: Gets or sets the version of the content. - :paramtype version: str - """ - super().__init__(**kwargs) - self.uri = uri - self.content_hash = content_hash - self.version = version - - -class ContentSource(_serialization.Model): - """Definition of the content source. - - :ivar hash: Gets or sets the hash. - :vartype hash: ~azure.mgmt.automation.models.ContentHash - :ivar type: Gets or sets the content source type. Known values are: "embeddedContent" and - "uri". - :vartype type: str or ~azure.mgmt.automation.models.ContentSourceType - :ivar value: Gets or sets the value of the content. This is based on the content source type. - :vartype value: str - :ivar version: Gets or sets the version of the content. - :vartype version: str - """ - - _attribute_map = { - "hash": {"key": "hash", "type": "ContentHash"}, - "type": {"key": "type", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, - *, - hash: Optional["_models.ContentHash"] = None, - type: Optional[Union[str, "_models.ContentSourceType"]] = None, - value: Optional[str] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword hash: Gets or sets the hash. - :paramtype hash: ~azure.mgmt.automation.models.ContentHash - :keyword type: Gets or sets the content source type. Known values are: "embeddedContent" and - "uri". - :paramtype type: str or ~azure.mgmt.automation.models.ContentSourceType - :keyword value: Gets or sets the value of the content. This is based on the content source - type. - :paramtype value: str - :keyword version: Gets or sets the version of the content. - :paramtype version: str - """ - super().__init__(**kwargs) - self.hash = hash - self.type = type - self.value = value - self.version = version - - -class Credential(ProxyResource): - """Definition of the credential. - - 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 user_name: Gets the user name of the credential. - :vartype user_name: str - :ivar creation_time: Gets the creation time. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Gets the last modified time. - :vartype last_modified_time: ~datetime.datetime - :ivar description: Gets or sets the description. - :vartype description: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "user_name": {"readonly": True}, - "creation_time": {"readonly": True}, - "last_modified_time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_name": {"key": "properties.userName", "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"}, - } - - def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword description: Gets or sets the description. - :paramtype description: str - """ - super().__init__(**kwargs) - self.user_name: Optional[str] = None - self.creation_time: Optional[datetime.datetime] = None - self.last_modified_time: Optional[datetime.datetime] = None - self.description = description - - -class CredentialCreateOrUpdateParameters(_serialization.Model): - """The parameters supplied to the create or update credential operation. - - All required parameters must be populated in order to send to server. - - :ivar name: Gets or sets the name of the credential. Required. - :vartype name: str - :ivar user_name: Gets or sets the user name of the credential. Required. - :vartype user_name: str - :ivar password: Gets or sets the password of the credential. Required. - :vartype password: str - :ivar description: Gets or sets the description of the credential. - :vartype description: str - """ - - _validation = { - "name": {"required": True}, - "user_name": {"required": True}, - "password": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "user_name": {"key": "properties.userName", "type": "str"}, - "password": {"key": "properties.password", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, *, name: str, user_name: str, password: str, description: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the credential. Required. - :paramtype name: str - :keyword user_name: Gets or sets the user name of the credential. Required. - :paramtype user_name: str - :keyword password: Gets or sets the password of the credential. Required. - :paramtype password: str - :keyword description: Gets or sets the description of the credential. - :paramtype description: str - """ - super().__init__(**kwargs) - self.name = name - self.user_name = user_name - self.password = password - self.description = description - - -class CredentialListResult(_serialization.Model): - """The response model for the list credential operation. - - :ivar value: Gets or sets a list of credentials. - :vartype value: list[~azure.mgmt.automation.models.Credential] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Credential]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Credential"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of credentials. - :paramtype value: list[~azure.mgmt.automation.models.Credential] - :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 CredentialUpdateParameters(_serialization.Model): - """The parameters supplied to the Update credential operation. - - :ivar name: Gets or sets the name of the credential. - :vartype name: str - :ivar user_name: Gets or sets the user name of the credential. - :vartype user_name: str - :ivar password: Gets or sets the password of the credential. - :vartype password: str - :ivar description: Gets or sets the description of the credential. - :vartype description: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "user_name": {"key": "properties.userName", "type": "str"}, - "password": {"key": "properties.password", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - user_name: Optional[str] = None, - password: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the credential. - :paramtype name: str - :keyword user_name: Gets or sets the user name of the credential. - :paramtype user_name: str - :keyword password: Gets or sets the password of the credential. - :paramtype password: str - :keyword description: Gets or sets the description of the credential. - :paramtype description: str - """ - super().__init__(**kwargs) - self.name = name - self.user_name = user_name - self.password = password - self.description = description - - -class DscCompilationJob(ProxyResource): - """Definition of the Dsc Compilation job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar configuration: Gets or sets the configuration. - :vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty - :ivar started_by: Gets the compilation job started by. - :vartype started_by: str - :ivar job_id: Gets the id of the job. - :vartype job_id: str - :ivar creation_time: Gets the creation time of the job. - :vartype creation_time: ~datetime.datetime - :ivar provisioning_state: The current provisioning state of the job. Known values are: - "Failed", "Succeeded", "Suspended", and "Processing". - :vartype provisioning_state: str or ~azure.mgmt.automation.models.JobProvisioningState - :ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be - executed. - :vartype run_on: str - :ivar status: Gets or sets the status of the job. Known values are: "New", "Activating", - "Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected", - "Suspending", "Stopping", "Resuming", and "Removing". - :vartype status: str or ~azure.mgmt.automation.models.JobStatus - :ivar status_details: Gets or sets the status details of the job. - :vartype status_details: str - :ivar start_time: Gets the start time of the job. - :vartype start_time: ~datetime.datetime - :ivar end_time: Gets the end time of the job. - :vartype end_time: ~datetime.datetime - :ivar exception: Gets the exception of the job. - :vartype exception: str - :ivar last_modified_time: Gets the last modified time of the job. - :vartype last_modified_time: ~datetime.datetime - :ivar last_status_modified_time: Gets the last status modified time of the job. - :vartype last_status_modified_time: ~datetime.datetime - :ivar parameters: Gets or sets the parameters of the job. - :vartype parameters: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "started_by": {"readonly": True}, - "job_id": {"readonly": True}, - "creation_time": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - "exception": {"readonly": True}, - "last_modified_time": {"readonly": True}, - "last_status_modified_time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "configuration": {"key": "properties.configuration", "type": "DscConfigurationAssociationProperty"}, - "started_by": {"key": "properties.startedBy", "type": "str"}, - "job_id": {"key": "properties.jobId", "type": "str"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "run_on": {"key": "properties.runOn", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "status_details": {"key": "properties.statusDetails", "type": "str"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "end_time": {"key": "properties.endTime", "type": "iso-8601"}, - "exception": {"key": "properties.exception", "type": "str"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "last_status_modified_time": {"key": "properties.lastStatusModifiedTime", "type": "iso-8601"}, - "parameters": {"key": "properties.parameters", "type": "{str}"}, - } - - def __init__( - self, - *, - configuration: Optional["_models.DscConfigurationAssociationProperty"] = None, - provisioning_state: Optional[Union[str, "_models.JobProvisioningState"]] = None, - run_on: Optional[str] = None, - status: Optional[Union[str, "_models.JobStatus"]] = None, - status_details: Optional[str] = None, - parameters: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword configuration: Gets or sets the configuration. - :paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty - :keyword provisioning_state: The current provisioning state of the job. Known values are: - "Failed", "Succeeded", "Suspended", and "Processing". - :paramtype provisioning_state: str or ~azure.mgmt.automation.models.JobProvisioningState - :keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be - executed. - :paramtype run_on: str - :keyword status: Gets or sets the status of the job. Known values are: "New", "Activating", - "Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected", - "Suspending", "Stopping", "Resuming", and "Removing". - :paramtype status: str or ~azure.mgmt.automation.models.JobStatus - :keyword status_details: Gets or sets the status details of the job. - :paramtype status_details: str - :keyword parameters: Gets or sets the parameters of the job. - :paramtype parameters: dict[str, str] - """ - super().__init__(**kwargs) - self.configuration = configuration - 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: 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 - - -class DscCompilationJobCreateParameters(_serialization.Model): - """The parameters supplied to the create compilation job operation. - - All required parameters must be populated in order to send to server. - - :ivar name: Gets or sets name of the resource. - :vartype name: str - :ivar location: Gets or sets the location of the resource. - :vartype location: str - :ivar tags: Gets or sets the tags attached to the resource. - :vartype tags: dict[str, str] - :ivar configuration: Gets or sets the configuration. Required. - :vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty - :ivar parameters: Gets or sets the parameters of the job. - :vartype parameters: dict[str, str] - :ivar increment_node_configuration_build: If a new build version of NodeConfiguration is - required. - :vartype increment_node_configuration_build: bool - """ - - _validation = { - "configuration": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "configuration": {"key": "properties.configuration", "type": "DscConfigurationAssociationProperty"}, - "parameters": {"key": "properties.parameters", "type": "{str}"}, - "increment_node_configuration_build": {"key": "properties.incrementNodeConfigurationBuild", "type": "bool"}, - } - - def __init__( - self, - *, - configuration: "_models.DscConfigurationAssociationProperty", - name: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - parameters: Optional[dict[str, str]] = None, - increment_node_configuration_build: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets name of the resource. - :paramtype name: str - :keyword location: Gets or sets the location of the resource. - :paramtype location: str - :keyword tags: Gets or sets the tags attached to the resource. - :paramtype tags: dict[str, str] - :keyword configuration: Gets or sets the configuration. Required. - :paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty - :keyword parameters: Gets or sets the parameters of the job. - :paramtype parameters: dict[str, str] - :keyword increment_node_configuration_build: If a new build version of NodeConfiguration is - required. - :paramtype increment_node_configuration_build: bool - """ - super().__init__(**kwargs) - self.name = name - self.location = location - self.tags = tags - self.configuration = configuration - self.parameters = parameters - self.increment_node_configuration_build = increment_node_configuration_build - - -class DscCompilationJobListResult(_serialization.Model): - """The response model for the list job operation. - - :ivar value: Gets or sets a list of Dsc Compilation jobs. - :vartype value: list[~azure.mgmt.automation.models.DscCompilationJob] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DscCompilationJob]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.DscCompilationJob"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of Dsc Compilation jobs. - :paramtype value: list[~azure.mgmt.automation.models.DscCompilationJob] - :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 DscConfiguration(TrackedResource): - """Definition of the configuration type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The Azure Region where the resource lives. - :vartype location: str - :ivar etag: Gets or sets the etag of the resource. - :vartype etag: str - :ivar provisioning_state: Gets or sets the provisioning state of the configuration. Default - value is "Succeeded". - :vartype provisioning_state: str - :ivar job_count: Gets or sets the job count of the configuration. - :vartype job_count: int - :ivar parameters: Gets or sets the configuration parameters. - :vartype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter] - :ivar source: Gets or sets the source. - :vartype source: ~azure.mgmt.automation.models.ContentSource - :ivar state: Gets or sets the state of the configuration. Known values are: "New", "Edit", and - "Published". - :vartype state: str or ~azure.mgmt.automation.models.DscConfigurationState - :ivar log_verbose: Gets or sets verbose log option. - :vartype log_verbose: bool - :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 node_configuration_count: Gets the number of compiled node configurations. - :vartype node_configuration_count: int - :ivar description: Gets or sets the description. - :vartype description: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "job_count": {"key": "properties.jobCount", "type": "int"}, - "parameters": {"key": "properties.parameters", "type": "{DscConfigurationParameter}"}, - "source": {"key": "properties.source", "type": "ContentSource"}, - "state": {"key": "properties.state", "type": "str"}, - "log_verbose": {"key": "properties.logVerbose", "type": "bool"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "node_configuration_count": {"key": "properties.nodeConfigurationCount", "type": "int"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, - *, - 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, - source: Optional["_models.ContentSource"] = None, - state: Optional[Union[str, "_models.DscConfigurationState"]] = None, - log_verbose: Optional[bool] = None, - creation_time: Optional[datetime.datetime] = None, - last_modified_time: Optional[datetime.datetime] = None, - node_configuration_count: Optional[int] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The Azure Region where the resource lives. - :paramtype location: str - :keyword etag: Gets or sets the etag of the resource. - :paramtype etag: str - :keyword provisioning_state: Gets or sets the provisioning state of the configuration. Default - value is "Succeeded". - :paramtype provisioning_state: str - :keyword job_count: Gets or sets the job count of the configuration. - :paramtype job_count: int - :keyword parameters: Gets or sets the configuration parameters. - :paramtype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter] - :keyword source: Gets or sets the source. - :paramtype source: ~azure.mgmt.automation.models.ContentSource - :keyword state: Gets or sets the state of the configuration. Known values are: "New", "Edit", - and "Published". - :paramtype state: str or ~azure.mgmt.automation.models.DscConfigurationState - :keyword log_verbose: Gets or sets verbose log option. - :paramtype log_verbose: bool - :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 node_configuration_count: Gets the number of compiled node configurations. - :paramtype node_configuration_count: int - :keyword description: Gets or sets the description. - :paramtype description: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag = etag - self.provisioning_state = provisioning_state - self.job_count = job_count - self.parameters = parameters - self.source = source - self.state = state - self.log_verbose = log_verbose - self.creation_time = creation_time - self.last_modified_time = last_modified_time - self.node_configuration_count = node_configuration_count - self.description = description - - -class DscConfigurationAssociationProperty(_serialization.Model): - """The Dsc configuration property associated with the entity. - - :ivar name: Gets or sets the name of the Dsc configuration. - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Gets or sets the name of the Dsc configuration. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class DscConfigurationCreateOrUpdateParameters(_serialization.Model): - """The parameters supplied to the create or update configuration operation. - - All required parameters must be populated in order to send to server. - - :ivar name: Gets or sets name of the resource. - :vartype name: str - :ivar location: Gets or sets the location of the resource. - :vartype location: str - :ivar tags: Gets or sets the tags attached to the resource. - :vartype tags: dict[str, str] - :ivar log_verbose: Gets or sets verbose log option. - :vartype log_verbose: bool - :ivar log_progress: Gets or sets progress log option. - :vartype log_progress: bool - :ivar source: Gets or sets the source. Required. - :vartype source: ~azure.mgmt.automation.models.ContentSource - :ivar parameters: Gets or sets the configuration parameters. - :vartype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter] - :ivar description: Gets or sets the description of the configuration. - :vartype description: str - """ - - _validation = { - "source": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "log_verbose": {"key": "properties.logVerbose", "type": "bool"}, - "log_progress": {"key": "properties.logProgress", "type": "bool"}, - "source": {"key": "properties.source", "type": "ContentSource"}, - "parameters": {"key": "properties.parameters", "type": "{DscConfigurationParameter}"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, - *, - source: "_models.ContentSource", - name: Optional[str] = None, - location: Optional[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, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets name of the resource. - :paramtype name: str - :keyword location: Gets or sets the location of the resource. - :paramtype location: str - :keyword tags: Gets or sets the tags attached to the resource. - :paramtype tags: dict[str, str] - :keyword log_verbose: Gets or sets verbose log option. - :paramtype log_verbose: bool - :keyword log_progress: Gets or sets progress log option. - :paramtype log_progress: bool - :keyword source: Gets or sets the source. Required. - :paramtype source: ~azure.mgmt.automation.models.ContentSource - :keyword parameters: Gets or sets the configuration parameters. - :paramtype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter] - :keyword description: Gets or sets the description of the configuration. - :paramtype description: str - """ - super().__init__(**kwargs) - self.name = name - self.location = location - self.tags = tags - self.log_verbose = log_verbose - self.log_progress = log_progress - self.source = source - self.parameters = parameters - self.description = description - - -class DscConfigurationListResult(_serialization.Model): - """The response model for the list configuration operation. - - :ivar value: Gets or sets a list of configurations. - :vartype value: list[~azure.mgmt.automation.models.DscConfiguration] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - :ivar total_count: Gets the total number of configurations matching filter criteria. - :vartype total_count: int - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DscConfiguration]"}, - "next_link": {"key": "nextLink", "type": "str"}, - "total_count": {"key": "totalCount", "type": "int"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.DscConfiguration"]] = None, - next_link: Optional[str] = None, - total_count: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of configurations. - :paramtype value: list[~azure.mgmt.automation.models.DscConfiguration] - :keyword next_link: Gets or sets the next link. - :paramtype next_link: str - :keyword total_count: Gets the total number of configurations matching filter criteria. - :paramtype total_count: int - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - self.total_count = total_count - - -class DscConfigurationParameter(_serialization.Model): - """Definition of the configuration parameter type. - - :ivar type: Gets or sets the type of the parameter. - :vartype type: str - :ivar is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is mandatory - or not. - :vartype is_mandatory: bool - :ivar position: Get or sets the position of the parameter. - :vartype position: int - :ivar default_value: Gets or sets the default value of parameter. - :vartype default_value: str - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "is_mandatory": {"key": "isMandatory", "type": "bool"}, - "position": {"key": "position", "type": "int"}, - "default_value": {"key": "defaultValue", "type": "str"}, - } - - def __init__( - self, - *, - type: Optional[str] = None, - is_mandatory: Optional[bool] = None, - position: Optional[int] = None, - default_value: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets or sets the type of the parameter. - :paramtype type: str - :keyword is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is - mandatory or not. - :paramtype is_mandatory: bool - :keyword position: Get or sets the position of the parameter. - :paramtype position: int - :keyword default_value: Gets or sets the default value of parameter. - :paramtype default_value: str - """ - super().__init__(**kwargs) - self.type = type - self.is_mandatory = is_mandatory - self.position = position - self.default_value = default_value - - -class DscConfigurationUpdateParameters(_serialization.Model): - """The parameters supplied to the create or update configuration operation. - - :ivar name: Gets or sets name of the resource. - :vartype name: str - :ivar tags: Gets or sets the tags attached to the resource. - :vartype tags: dict[str, str] - :ivar log_verbose: Gets or sets verbose log option. - :vartype log_verbose: bool - :ivar log_progress: Gets or sets progress log option. - :vartype log_progress: bool - :ivar source: Gets or sets the source. - :vartype source: ~azure.mgmt.automation.models.ContentSource - :ivar parameters: Gets or sets the configuration parameters. - :vartype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter] - :ivar description: Gets or sets the description of the configuration. - :vartype description: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "log_verbose": {"key": "properties.logVerbose", "type": "bool"}, - "log_progress": {"key": "properties.logProgress", "type": "bool"}, - "source": {"key": "properties.source", "type": "ContentSource"}, - "parameters": {"key": "properties.parameters", "type": "{DscConfigurationParameter}"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[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, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets name of the resource. - :paramtype name: str - :keyword tags: Gets or sets the tags attached to the resource. - :paramtype tags: dict[str, str] - :keyword log_verbose: Gets or sets verbose log option. - :paramtype log_verbose: bool - :keyword log_progress: Gets or sets progress log option. - :paramtype log_progress: bool - :keyword source: Gets or sets the source. - :paramtype source: ~azure.mgmt.automation.models.ContentSource - :keyword parameters: Gets or sets the configuration parameters. - :paramtype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter] - :keyword description: Gets or sets the description of the configuration. - :paramtype description: str - """ - super().__init__(**kwargs) - self.name = name - self.tags = tags - self.log_verbose = log_verbose - self.log_progress = log_progress - self.source = source - self.parameters = parameters - self.description = description - - -class DscMetaConfiguration(_serialization.Model): - """Definition of the DSC Meta Configuration. - - :ivar configuration_mode_frequency_mins: Gets or sets the ConfigurationModeFrequencyMins value - of the meta configuration. - :vartype configuration_mode_frequency_mins: int - :ivar reboot_node_if_needed: Gets or sets the RebootNodeIfNeeded value of the meta - configuration. - :vartype reboot_node_if_needed: bool - :ivar configuration_mode: Gets or sets the ConfigurationMode value of the meta configuration. - :vartype configuration_mode: str - :ivar action_after_reboot: Gets or sets the ActionAfterReboot value of the meta configuration. - :vartype action_after_reboot: str - :ivar certificate_id: Gets or sets the CertificateId value of the meta configuration. - :vartype certificate_id: str - :ivar refresh_frequency_mins: Gets or sets the RefreshFrequencyMins value of the meta - configuration. - :vartype refresh_frequency_mins: int - :ivar allow_module_overwrite: Gets or sets the AllowModuleOverwrite value of the meta - configuration. - :vartype allow_module_overwrite: bool - """ - - _attribute_map = { - "configuration_mode_frequency_mins": {"key": "configurationModeFrequencyMins", "type": "int"}, - "reboot_node_if_needed": {"key": "rebootNodeIfNeeded", "type": "bool"}, - "configuration_mode": {"key": "configurationMode", "type": "str"}, - "action_after_reboot": {"key": "actionAfterReboot", "type": "str"}, - "certificate_id": {"key": "certificateId", "type": "str"}, - "refresh_frequency_mins": {"key": "refreshFrequencyMins", "type": "int"}, - "allow_module_overwrite": {"key": "allowModuleOverwrite", "type": "bool"}, - } - - def __init__( - self, - *, - configuration_mode_frequency_mins: Optional[int] = None, - reboot_node_if_needed: Optional[bool] = None, - configuration_mode: Optional[str] = None, - action_after_reboot: Optional[str] = None, - certificate_id: Optional[str] = None, - refresh_frequency_mins: Optional[int] = None, - allow_module_overwrite: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword configuration_mode_frequency_mins: Gets or sets the ConfigurationModeFrequencyMins - value of the meta configuration. - :paramtype configuration_mode_frequency_mins: int - :keyword reboot_node_if_needed: Gets or sets the RebootNodeIfNeeded value of the meta - configuration. - :paramtype reboot_node_if_needed: bool - :keyword configuration_mode: Gets or sets the ConfigurationMode value of the meta - configuration. - :paramtype configuration_mode: str - :keyword action_after_reboot: Gets or sets the ActionAfterReboot value of the meta - configuration. - :paramtype action_after_reboot: str - :keyword certificate_id: Gets or sets the CertificateId value of the meta configuration. - :paramtype certificate_id: str - :keyword refresh_frequency_mins: Gets or sets the RefreshFrequencyMins value of the meta - configuration. - :paramtype refresh_frequency_mins: int - :keyword allow_module_overwrite: Gets or sets the AllowModuleOverwrite value of the meta - configuration. - :paramtype allow_module_overwrite: bool - """ - super().__init__(**kwargs) - self.configuration_mode_frequency_mins = configuration_mode_frequency_mins - self.reboot_node_if_needed = reboot_node_if_needed - self.configuration_mode = configuration_mode - self.action_after_reboot = action_after_reboot - self.certificate_id = certificate_id - self.refresh_frequency_mins = refresh_frequency_mins - self.allow_module_overwrite = allow_module_overwrite - - -class DscNode(ProxyResource): - """Definition of a DscNode. - - 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 last_seen: Gets or sets the last seen time of the node. - :vartype last_seen: ~datetime.datetime - :ivar registration_time: Gets or sets the registration time of the node. - :vartype registration_time: ~datetime.datetime - :ivar ip: Gets or sets the ip of the node. - :vartype ip: str - :ivar account_id: Gets or sets the account id of the node. - :vartype account_id: str - :ivar status: Gets or sets the status of the node. - :vartype status: str - :ivar node_id: Gets or sets the node id. - :vartype node_id: str - :ivar etag: Gets or sets the etag of the resource. - :vartype etag: str - :ivar total_count: Gets the total number of records matching filter criteria. - :vartype total_count: int - :ivar extension_handler: Gets or sets the list of extensionHandler properties for a Node. - :vartype extension_handler: - list[~azure.mgmt.automation.models.DscNodeExtensionHandlerAssociationProperty] - :ivar name_properties_node_configuration_name: Gets or sets the name of the dsc node - configuration. - :vartype name_properties_node_configuration_name: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "last_seen": {"key": "properties.lastSeen", "type": "iso-8601"}, - "registration_time": {"key": "properties.registrationTime", "type": "iso-8601"}, - "ip": {"key": "properties.ip", "type": "str"}, - "account_id": {"key": "properties.accountId", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "node_id": {"key": "properties.nodeId", "type": "str"}, - "etag": {"key": "properties.etag", "type": "str"}, - "total_count": {"key": "properties.totalCount", "type": "int"}, - "extension_handler": { - "key": "properties.extensionHandler", - "type": "[DscNodeExtensionHandlerAssociationProperty]", - }, - "name_properties_node_configuration_name": {"key": "properties.nodeConfiguration.name", "type": "str"}, - } - - def __init__( - self, - *, - last_seen: Optional[datetime.datetime] = None, - registration_time: Optional[datetime.datetime] = None, - ip: Optional[str] = None, - account_id: Optional[str] = None, - status: Optional[str] = None, - node_id: Optional[str] = None, - etag: Optional[str] = None, - total_count: Optional[int] = None, - extension_handler: Optional[list["_models.DscNodeExtensionHandlerAssociationProperty"]] = None, - name_properties_node_configuration_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword last_seen: Gets or sets the last seen time of the node. - :paramtype last_seen: ~datetime.datetime - :keyword registration_time: Gets or sets the registration time of the node. - :paramtype registration_time: ~datetime.datetime - :keyword ip: Gets or sets the ip of the node. - :paramtype ip: str - :keyword account_id: Gets or sets the account id of the node. - :paramtype account_id: str - :keyword status: Gets or sets the status of the node. - :paramtype status: str - :keyword node_id: Gets or sets the node id. - :paramtype node_id: str - :keyword etag: Gets or sets the etag of the resource. - :paramtype etag: str - :keyword total_count: Gets the total number of records matching filter criteria. - :paramtype total_count: int - :keyword extension_handler: Gets or sets the list of extensionHandler properties for a Node. - :paramtype extension_handler: - list[~azure.mgmt.automation.models.DscNodeExtensionHandlerAssociationProperty] - :keyword name_properties_node_configuration_name: Gets or sets the name of the dsc node - configuration. - :paramtype name_properties_node_configuration_name: str - """ - super().__init__(**kwargs) - self.last_seen = last_seen - self.registration_time = registration_time - self.ip = ip - self.account_id = account_id - self.status = status - self.node_id = node_id - self.etag = etag - self.total_count = total_count - self.extension_handler = extension_handler - self.name_properties_node_configuration_name = name_properties_node_configuration_name - - -class DscNodeConfiguration(ProxyResource): - """Definition of the dsc node configuration. - - 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 last_modified_time: Gets or sets the last modified time. - :vartype last_modified_time: ~datetime.datetime - :ivar creation_time: Gets or sets creation time. - :vartype creation_time: ~datetime.datetime - :ivar configuration: Gets or sets the configuration of the node. - :vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty - :ivar source: Source of node configuration. - :vartype source: str - :ivar node_count: Number of nodes with this node configuration assigned. - :vartype node_count: int - :ivar increment_node_configuration_build: If a new build version of NodeConfiguration is - required. - :vartype increment_node_configuration_build: bool - """ - - _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"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "configuration": {"key": "properties.configuration", "type": "DscConfigurationAssociationProperty"}, - "source": {"key": "properties.source", "type": "str"}, - "node_count": {"key": "properties.nodeCount", "type": "int"}, - "increment_node_configuration_build": {"key": "properties.incrementNodeConfigurationBuild", "type": "bool"}, - } - - def __init__( - self, - *, - last_modified_time: Optional[datetime.datetime] = None, - creation_time: Optional[datetime.datetime] = None, - configuration: Optional["_models.DscConfigurationAssociationProperty"] = None, - source: Optional[str] = None, - node_count: Optional[int] = None, - increment_node_configuration_build: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword last_modified_time: Gets or sets the last modified time. - :paramtype last_modified_time: ~datetime.datetime - :keyword creation_time: Gets or sets creation time. - :paramtype creation_time: ~datetime.datetime - :keyword configuration: Gets or sets the configuration of the node. - :paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty - :keyword source: Source of node configuration. - :paramtype source: str - :keyword node_count: Number of nodes with this node configuration assigned. - :paramtype node_count: int - :keyword increment_node_configuration_build: If a new build version of NodeConfiguration is - required. - :paramtype increment_node_configuration_build: bool - """ - super().__init__(**kwargs) - self.last_modified_time = last_modified_time - self.creation_time = creation_time - self.configuration = configuration - self.source = source - self.node_count = node_count - self.increment_node_configuration_build = increment_node_configuration_build - - -class DscNodeConfigurationCreateOrUpdateParameters(_serialization.Model): # pylint: disable=name-too-long - """The parameters supplied to the create or update node configuration operation. - - :ivar name: Name of the node configuration. - :vartype name: str - :ivar tags: Gets or sets the tags attached to the resource. - :vartype tags: dict[str, str] - :ivar source: Gets or sets the source. - :vartype source: ~azure.mgmt.automation.models.ContentSource - :ivar configuration: Gets or sets the configuration of the node. - :vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty - :ivar increment_node_configuration_build: If a new build version of NodeConfiguration is - required. - :vartype increment_node_configuration_build: bool - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "source": {"key": "properties.source", "type": "ContentSource"}, - "configuration": {"key": "properties.configuration", "type": "DscConfigurationAssociationProperty"}, - "increment_node_configuration_build": {"key": "properties.incrementNodeConfigurationBuild", "type": "bool"}, - } - - def __init__( - self, - *, - name: Optional[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, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the node configuration. - :paramtype name: str - :keyword tags: Gets or sets the tags attached to the resource. - :paramtype tags: dict[str, str] - :keyword source: Gets or sets the source. - :paramtype source: ~azure.mgmt.automation.models.ContentSource - :keyword configuration: Gets or sets the configuration of the node. - :paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty - :keyword increment_node_configuration_build: If a new build version of NodeConfiguration is - required. - :paramtype increment_node_configuration_build: bool - """ - super().__init__(**kwargs) - self.name = name - self.tags = tags - self.source = source - self.configuration = configuration - self.increment_node_configuration_build = increment_node_configuration_build - - -class DscNodeConfigurationListResult(_serialization.Model): - """The response model for the list job operation. - - :ivar value: Gets or sets a list of Dsc node configurations. - :vartype value: list[~azure.mgmt.automation.models.DscNodeConfiguration] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - :ivar total_count: Gets or sets the total rows in query. - :vartype total_count: int - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DscNodeConfiguration]"}, - "next_link": {"key": "nextLink", "type": "str"}, - "total_count": {"key": "totalCount", "type": "int"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.DscNodeConfiguration"]] = None, - next_link: Optional[str] = None, - total_count: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of Dsc node configurations. - :paramtype value: list[~azure.mgmt.automation.models.DscNodeConfiguration] - :keyword next_link: Gets or sets the next link. - :paramtype next_link: str - :keyword total_count: Gets or sets the total rows in query. - :paramtype total_count: int - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - self.total_count = total_count - - -class DscNodeExtensionHandlerAssociationProperty(_serialization.Model): # pylint: disable=name-too-long - """The dsc extensionHandler property associated with the node. - - :ivar name: Gets or sets the name of the extension handler. - :vartype name: str - :ivar version: Gets or sets the version of the extension handler. - :vartype version: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Gets or sets the name of the extension handler. - :paramtype name: str - :keyword version: Gets or sets the version of the extension handler. - :paramtype version: str - """ - super().__init__(**kwargs) - self.name = name - self.version = version - - -class DscNodeListResult(_serialization.Model): - """The response model for the list dsc nodes operation. - - :ivar value: Gets or sets a list of dsc nodes. - :vartype value: list[~azure.mgmt.automation.models.DscNode] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - :ivar total_count: Gets the total number of nodes matching filter criteria. - :vartype total_count: int - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DscNode]"}, - "next_link": {"key": "nextLink", "type": "str"}, - "total_count": {"key": "totalCount", "type": "int"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.DscNode"]] = None, - next_link: Optional[str] = None, - total_count: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of dsc nodes. - :paramtype value: list[~azure.mgmt.automation.models.DscNode] - :keyword next_link: Gets or sets the next link. - :paramtype next_link: str - :keyword total_count: Gets the total number of nodes matching filter criteria. - :paramtype total_count: int - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - self.total_count = total_count - - -class DscNodeReport(_serialization.Model): - """Definition of the dsc node report type. - - :ivar end_time: Gets or sets the end time of the node report. - :vartype end_time: ~datetime.datetime - :ivar last_modified_time: Gets or sets the lastModifiedTime of the node report. - :vartype last_modified_time: ~datetime.datetime - :ivar start_time: Gets or sets the start time of the node report. - :vartype start_time: ~datetime.datetime - :ivar type: Gets or sets the type of the node report. - :vartype type: str - :ivar report_id: Gets or sets the id of the node report. - :vartype report_id: str - :ivar status: Gets or sets the status of the node report. - :vartype status: str - :ivar refresh_mode: Gets or sets the refreshMode of the node report. - :vartype refresh_mode: str - :ivar reboot_requested: Gets or sets the rebootRequested of the node report. - :vartype reboot_requested: str - :ivar report_format_version: Gets or sets the reportFormatVersion of the node report. - :vartype report_format_version: str - :ivar configuration_version: Gets or sets the configurationVersion of the node report. - :vartype configuration_version: str - :ivar id: Gets or sets the id. - :vartype id: str - :ivar errors: Gets or sets the errors for the node report. - :vartype errors: list[~azure.mgmt.automation.models.DscReportError] - :ivar resources: Gets or sets the resource for the node report. - :vartype resources: list[~azure.mgmt.automation.models.DscReportResource] - :ivar meta_configuration: Gets or sets the metaConfiguration of the node at the time of the - report. - :vartype meta_configuration: ~azure.mgmt.automation.models.DscMetaConfiguration - :ivar host_name: Gets or sets the hostname of the node that sent the report. - :vartype host_name: str - :ivar i_pv4_addresses: Gets or sets the IPv4 address of the node that sent the report. - :vartype i_pv4_addresses: list[str] - :ivar i_pv6_addresses: Gets or sets the IPv6 address of the node that sent the report. - :vartype i_pv6_addresses: list[str] - :ivar number_of_resources: Gets or sets the number of resource in the node report. - :vartype number_of_resources: int - :ivar raw_errors: Gets or sets the unparsed errors for the node report. - :vartype raw_errors: str - """ - - _attribute_map = { - "end_time": {"key": "endTime", "type": "iso-8601"}, - "last_modified_time": {"key": "lastModifiedTime", "type": "iso-8601"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "type": {"key": "type", "type": "str"}, - "report_id": {"key": "reportId", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "refresh_mode": {"key": "refreshMode", "type": "str"}, - "reboot_requested": {"key": "rebootRequested", "type": "str"}, - "report_format_version": {"key": "reportFormatVersion", "type": "str"}, - "configuration_version": {"key": "configurationVersion", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "errors": {"key": "errors", "type": "[DscReportError]"}, - "resources": {"key": "resources", "type": "[DscReportResource]"}, - "meta_configuration": {"key": "metaConfiguration", "type": "DscMetaConfiguration"}, - "host_name": {"key": "hostName", "type": "str"}, - "i_pv4_addresses": {"key": "iPV4Addresses", "type": "[str]"}, - "i_pv6_addresses": {"key": "iPV6Addresses", "type": "[str]"}, - "number_of_resources": {"key": "numberOfResources", "type": "int"}, - "raw_errors": {"key": "rawErrors", "type": "str"}, - } - - def __init__( - self, - *, - end_time: Optional[datetime.datetime] = None, - last_modified_time: Optional[datetime.datetime] = None, - start_time: Optional[datetime.datetime] = None, - type: Optional[str] = None, - report_id: Optional[str] = None, - status: Optional[str] = None, - refresh_mode: Optional[str] = None, - reboot_requested: Optional[str] = None, - 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, - 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, - number_of_resources: Optional[int] = None, - raw_errors: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword end_time: Gets or sets the end time of the node report. - :paramtype end_time: ~datetime.datetime - :keyword last_modified_time: Gets or sets the lastModifiedTime of the node report. - :paramtype last_modified_time: ~datetime.datetime - :keyword start_time: Gets or sets the start time of the node report. - :paramtype start_time: ~datetime.datetime - :keyword type: Gets or sets the type of the node report. - :paramtype type: str - :keyword report_id: Gets or sets the id of the node report. - :paramtype report_id: str - :keyword status: Gets or sets the status of the node report. - :paramtype status: str - :keyword refresh_mode: Gets or sets the refreshMode of the node report. - :paramtype refresh_mode: str - :keyword reboot_requested: Gets or sets the rebootRequested of the node report. - :paramtype reboot_requested: str - :keyword report_format_version: Gets or sets the reportFormatVersion of the node report. - :paramtype report_format_version: str - :keyword configuration_version: Gets or sets the configurationVersion of the node report. - :paramtype configuration_version: str - :keyword id: Gets or sets the id. - :paramtype id: str - :keyword errors: Gets or sets the errors for the node report. - :paramtype errors: list[~azure.mgmt.automation.models.DscReportError] - :keyword resources: Gets or sets the resource for the node report. - :paramtype resources: list[~azure.mgmt.automation.models.DscReportResource] - :keyword meta_configuration: Gets or sets the metaConfiguration of the node at the time of the - report. - :paramtype meta_configuration: ~azure.mgmt.automation.models.DscMetaConfiguration - :keyword host_name: Gets or sets the hostname of the node that sent the report. - :paramtype host_name: str - :keyword i_pv4_addresses: Gets or sets the IPv4 address of the node that sent the report. - :paramtype i_pv4_addresses: list[str] - :keyword i_pv6_addresses: Gets or sets the IPv6 address of the node that sent the report. - :paramtype i_pv6_addresses: list[str] - :keyword number_of_resources: Gets or sets the number of resource in the node report. - :paramtype number_of_resources: int - :keyword raw_errors: Gets or sets the unparsed errors for the node report. - :paramtype raw_errors: str - """ - super().__init__(**kwargs) - self.end_time = end_time - self.last_modified_time = last_modified_time - self.start_time = start_time - self.type = type - self.report_id = report_id - self.status = status - self.refresh_mode = refresh_mode - self.reboot_requested = reboot_requested - self.report_format_version = report_format_version - self.configuration_version = configuration_version - self.id = id - self.errors = errors - self.resources = resources - self.meta_configuration = meta_configuration - self.host_name = host_name - self.i_pv4_addresses = i_pv4_addresses - self.i_pv6_addresses = i_pv6_addresses - self.number_of_resources = number_of_resources - self.raw_errors = raw_errors - - -class DscNodeReportListResult(_serialization.Model): - """The response model for the list dsc nodes operation. - - :ivar value: Gets or sets a list of dsc node reports. - :vartype value: list[~azure.mgmt.automation.models.DscNodeReport] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DscNodeReport]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.DscNodeReport"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of dsc node reports. - :paramtype value: list[~azure.mgmt.automation.models.DscNodeReport] - :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 DscNodeUpdateParameters(_serialization.Model): - """The parameters supplied to the update dsc node operation. - - :ivar node_id: Gets or sets the id of the dsc node. - :vartype node_id: str - :ivar properties: - :vartype properties: ~azure.mgmt.automation.models.DscNodeUpdateParametersProperties - """ - - _attribute_map = { - "node_id": {"key": "nodeId", "type": "str"}, - "properties": {"key": "properties", "type": "DscNodeUpdateParametersProperties"}, - } - - def __init__( - self, - *, - node_id: Optional[str] = None, - properties: Optional["_models.DscNodeUpdateParametersProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword node_id: Gets or sets the id of the dsc node. - :paramtype node_id: str - :keyword properties: - :paramtype properties: ~azure.mgmt.automation.models.DscNodeUpdateParametersProperties - """ - super().__init__(**kwargs) - self.node_id = node_id - self.properties = properties - - -class DscNodeUpdateParametersProperties(_serialization.Model): - """DscNodeUpdateParametersProperties. - - :ivar name: Gets or sets the name of the dsc node configuration. - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "nodeConfiguration.name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Gets or sets the name of the dsc node configuration. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class DscReportError(_serialization.Model): - """Definition of the dsc node report error type. - - :ivar error_source: Gets or sets the source of the error. - :vartype error_source: str - :ivar resource_id: Gets or sets the resource ID which generated the error. - :vartype resource_id: str - :ivar error_code: Gets or sets the error code. - :vartype error_code: str - :ivar error_message: Gets or sets the error message. - :vartype error_message: str - :ivar locale: Gets or sets the locale of the error. - :vartype locale: str - :ivar error_details: Gets or sets the error details. - :vartype error_details: str - """ - - _attribute_map = { - "error_source": {"key": "errorSource", "type": "str"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "locale": {"key": "locale", "type": "str"}, - "error_details": {"key": "errorDetails", "type": "str"}, - } - - def __init__( - self, - *, - error_source: Optional[str] = None, - resource_id: Optional[str] = None, - error_code: Optional[str] = None, - error_message: Optional[str] = None, - locale: Optional[str] = None, - error_details: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword error_source: Gets or sets the source of the error. - :paramtype error_source: str - :keyword resource_id: Gets or sets the resource ID which generated the error. - :paramtype resource_id: str - :keyword error_code: Gets or sets the error code. - :paramtype error_code: str - :keyword error_message: Gets or sets the error message. - :paramtype error_message: str - :keyword locale: Gets or sets the locale of the error. - :paramtype locale: str - :keyword error_details: Gets or sets the error details. - :paramtype error_details: str - """ - super().__init__(**kwargs) - self.error_source = error_source - self.resource_id = resource_id - self.error_code = error_code - self.error_message = error_message - self.locale = locale - self.error_details = error_details - - -class DscReportResource(_serialization.Model): - """Definition of the DSC Report Resource. - - :ivar resource_id: Gets or sets the ID of the resource. - :vartype resource_id: str - :ivar source_info: Gets or sets the source info of the resource. - :vartype source_info: str - :ivar depends_on: Gets or sets the Resource Navigation values for resources the resource - depends on. - :vartype depends_on: list[~azure.mgmt.automation.models.DscReportResourceNavigation] - :ivar module_name: Gets or sets the module name of the resource. - :vartype module_name: str - :ivar module_version: Gets or sets the module version of the resource. - :vartype module_version: str - :ivar resource_name: Gets or sets the name of the resource. - :vartype resource_name: str - :ivar error: Gets or sets the error of the resource. - :vartype error: str - :ivar status: Gets or sets the status of the resource. - :vartype status: str - :ivar duration_in_seconds: Gets or sets the duration in seconds for the resource. - :vartype duration_in_seconds: float - :ivar start_date: Gets or sets the start date of the resource. - :vartype start_date: ~datetime.datetime - """ - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - "source_info": {"key": "sourceInfo", "type": "str"}, - "depends_on": {"key": "dependsOn", "type": "[DscReportResourceNavigation]"}, - "module_name": {"key": "moduleName", "type": "str"}, - "module_version": {"key": "moduleVersion", "type": "str"}, - "resource_name": {"key": "resourceName", "type": "str"}, - "error": {"key": "error", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "duration_in_seconds": {"key": "durationInSeconds", "type": "float"}, - "start_date": {"key": "startDate", "type": "iso-8601"}, - } - - def __init__( - self, - *, - resource_id: Optional[str] = None, - source_info: Optional[str] = None, - depends_on: Optional[list["_models.DscReportResourceNavigation"]] = None, - module_name: Optional[str] = None, - module_version: Optional[str] = None, - resource_name: Optional[str] = None, - error: Optional[str] = None, - status: Optional[str] = None, - duration_in_seconds: Optional[float] = None, - start_date: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword resource_id: Gets or sets the ID of the resource. - :paramtype resource_id: str - :keyword source_info: Gets or sets the source info of the resource. - :paramtype source_info: str - :keyword depends_on: Gets or sets the Resource Navigation values for resources the resource - depends on. - :paramtype depends_on: list[~azure.mgmt.automation.models.DscReportResourceNavigation] - :keyword module_name: Gets or sets the module name of the resource. - :paramtype module_name: str - :keyword module_version: Gets or sets the module version of the resource. - :paramtype module_version: str - :keyword resource_name: Gets or sets the name of the resource. - :paramtype resource_name: str - :keyword error: Gets or sets the error of the resource. - :paramtype error: str - :keyword status: Gets or sets the status of the resource. - :paramtype status: str - :keyword duration_in_seconds: Gets or sets the duration in seconds for the resource. - :paramtype duration_in_seconds: float - :keyword start_date: Gets or sets the start date of the resource. - :paramtype start_date: ~datetime.datetime - """ - super().__init__(**kwargs) - self.resource_id = resource_id - self.source_info = source_info - self.depends_on = depends_on - self.module_name = module_name - self.module_version = module_version - self.resource_name = resource_name - self.error = error - self.status = status - self.duration_in_seconds = duration_in_seconds - self.start_date = start_date - - -class DscReportResourceNavigation(_serialization.Model): - """Navigation for DSC Report Resource. - - :ivar resource_id: Gets or sets the ID of the resource to navigate to. - :vartype resource_id: str - """ - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - } - - def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resource_id: Gets or sets the ID of the resource to navigate to. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -class ErrorResponse(_serialization.Model): - """Error response of an operation failure. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword code: Error code. - :paramtype code: str - :keyword message: Error message indicating why the operation failed. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class FieldDefinition(_serialization.Model): - """Definition of the connection fields. - - All required parameters must be populated in order to send to server. - - :ivar is_encrypted: Gets or sets the isEncrypted flag of the connection field definition. - :vartype is_encrypted: bool - :ivar is_optional: Gets or sets the isOptional flag of the connection field definition. - :vartype is_optional: bool - :ivar type: Gets or sets the type of the connection field definition. Required. - :vartype type: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "is_encrypted": {"key": "isEncrypted", "type": "bool"}, - "is_optional": {"key": "isOptional", "type": "bool"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, *, type: str, is_encrypted: Optional[bool] = None, is_optional: Optional[bool] = None, **kwargs: Any - ) -> None: - """ - :keyword is_encrypted: Gets or sets the isEncrypted flag of the connection field definition. - :paramtype is_encrypted: bool - :keyword is_optional: Gets or sets the isOptional flag of the connection field definition. - :paramtype is_optional: bool - :keyword type: Gets or sets the type of the connection field definition. Required. - :paramtype type: str - """ - super().__init__(**kwargs) - self.is_encrypted = is_encrypted - self.is_optional = is_optional - self.type = type - - -class HybridRunbookWorker(_serialization.Model): - """Definition of hybrid runbook worker. - - :ivar name: Gets or sets the worker machine name. - :vartype name: str - :ivar ip: Gets or sets the assigned machine IP address. - :vartype ip: str - :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 - """ - - _attribute_map = { - "name": {"key": "name", "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, - registration_time: Optional[datetime.datetime] = None, - last_seen_date_time: Optional[datetime.datetime] = 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 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 - """ - super().__init__(**kwargs) - self.name = name - self.ip = ip - self.registration_time = registration_time - self.last_seen_date_time = last_seen_date_time - - -class HybridRunbookWorkerGroup(_serialization.Model): - """Definition of hybrid runbook worker group. - - :ivar id: Gets or sets the id of the resource. - :vartype id: str - :ivar name: Gets or sets the name of the group. - :vartype name: str - :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 - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "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 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): - """The response model for the list hybrid runbook worker groups. - - :ivar value: Gets or sets a list of hybrid runbook worker groups. - :vartype value: list[~azure.mgmt.automation.models.HybridRunbookWorkerGroup] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[HybridRunbookWorkerGroup]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.HybridRunbookWorkerGroup"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of hybrid runbook worker groups. - :paramtype value: list[~azure.mgmt.automation.models.HybridRunbookWorkerGroup] - :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 HybridRunbookWorkerGroupUpdateParameters(_serialization.Model): - """Parameters supplied to the update operation. - - :ivar credential: Sets the credential of a worker group. - :vartype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty - """ - - _attribute_map = { - "credential": {"key": "credential", "type": "RunAsCredentialAssociationProperty"}, - } - - def __init__( - self, *, credential: Optional["_models.RunAsCredentialAssociationProperty"] = None, **kwargs: Any - ) -> None: - """ - :keyword credential: Sets the credential of a worker group. - :paramtype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty - """ - super().__init__(**kwargs) - self.credential = credential - - -class Job(ProxyResource): - """Definition of the job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar runbook: Gets or sets the runbook. - :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty - :ivar started_by: Gets or sets the job started by. - :vartype started_by: str - :ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be - executed. - :vartype run_on: str - :ivar job_id: Gets or sets the id of the job. - :vartype job_id: str - :ivar creation_time: Gets or sets the creation time of the job. - :vartype creation_time: ~datetime.datetime - :ivar status: Gets or sets the status of the job. Known values are: "New", "Activating", - "Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected", - "Suspending", "Stopping", "Resuming", and "Removing". - :vartype status: str or ~azure.mgmt.automation.models.JobStatus - :ivar status_details: Gets or sets the status details of the job. - :vartype status_details: str - :ivar start_time: Gets or sets the start time of the job. - :vartype start_time: ~datetime.datetime - :ivar end_time: Gets or sets the end time of the job. - :vartype end_time: ~datetime.datetime - :ivar exception: Gets or sets the exception of the job. - :vartype exception: str - :ivar last_modified_time: Gets or sets the last modified time of the job. - :vartype last_modified_time: ~datetime.datetime - :ivar last_status_modified_time: Gets or sets the last status modified time of the job. - :vartype last_status_modified_time: ~datetime.datetime - :ivar parameters: Gets or sets the parameters of the job. - :vartype parameters: dict[str, str] - :ivar provisioning_state: The current provisioning state of the job. Known values are: - "Failed", "Succeeded", "Suspended", and "Processing". - :vartype provisioning_state: str or ~azure.mgmt.automation.models.JobProvisioningState - """ - - _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"}, - "runbook": {"key": "properties.runbook", "type": "RunbookAssociationProperty"}, - "started_by": {"key": "properties.startedBy", "type": "str"}, - "run_on": {"key": "properties.runOn", "type": "str"}, - "job_id": {"key": "properties.jobId", "type": "str"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "status": {"key": "properties.status", "type": "str"}, - "status_details": {"key": "properties.statusDetails", "type": "str"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "end_time": {"key": "properties.endTime", "type": "iso-8601"}, - "exception": {"key": "properties.exception", "type": "str"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "last_status_modified_time": {"key": "properties.lastStatusModifiedTime", "type": "iso-8601"}, - "parameters": {"key": "properties.parameters", "type": "{str}"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - runbook: Optional["_models.RunbookAssociationProperty"] = None, - started_by: Optional[str] = None, - run_on: Optional[str] = None, - job_id: Optional[str] = None, - creation_time: Optional[datetime.datetime] = None, - status: Optional[Union[str, "_models.JobStatus"]] = None, - status_details: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - 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, - provisioning_state: Optional[Union[str, "_models.JobProvisioningState"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword runbook: Gets or sets the runbook. - :paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty - :keyword started_by: Gets or sets the job started by. - :paramtype started_by: str - :keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be - executed. - :paramtype run_on: str - :keyword job_id: Gets or sets the id of the job. - :paramtype job_id: str - :keyword creation_time: Gets or sets the creation time of the job. - :paramtype creation_time: ~datetime.datetime - :keyword status: Gets or sets the status of the job. Known values are: "New", "Activating", - "Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected", - "Suspending", "Stopping", "Resuming", and "Removing". - :paramtype status: str or ~azure.mgmt.automation.models.JobStatus - :keyword status_details: Gets or sets the status details of the job. - :paramtype status_details: str - :keyword start_time: Gets or sets the start time of the job. - :paramtype start_time: ~datetime.datetime - :keyword end_time: Gets or sets the end time of the job. - :paramtype end_time: ~datetime.datetime - :keyword exception: Gets or sets the exception of the job. - :paramtype exception: str - :keyword last_modified_time: Gets or sets the last modified time of the job. - :paramtype last_modified_time: ~datetime.datetime - :keyword last_status_modified_time: Gets or sets the last status modified time of the job. - :paramtype last_status_modified_time: ~datetime.datetime - :keyword parameters: Gets or sets the parameters of the job. - :paramtype parameters: dict[str, str] - :keyword provisioning_state: The current provisioning state of the job. Known values are: - "Failed", "Succeeded", "Suspended", and "Processing". - :paramtype provisioning_state: str or ~azure.mgmt.automation.models.JobProvisioningState - """ - super().__init__(**kwargs) - self.runbook = runbook - self.started_by = started_by - self.run_on = run_on - self.job_id = job_id - self.creation_time = creation_time - self.status = status - self.status_details = status_details - self.start_time = start_time - self.end_time = end_time - self.exception = exception - self.last_modified_time = last_modified_time - self.last_status_modified_time = last_status_modified_time - self.parameters = parameters - self.provisioning_state = provisioning_state - - -class JobCollectionItem(ProxyResource): - """Job collection item properties. - - 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 runbook: The runbook association. - :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty - :ivar job_id: The id of the job. - :vartype job_id: str - :ivar creation_time: The creation time of the job. - :vartype creation_time: ~datetime.datetime - :ivar status: The status of the job. Known values are: "New", "Activating", "Running", - "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected", "Suspending", - "Stopping", "Resuming", and "Removing". - :vartype status: str or ~azure.mgmt.automation.models.JobStatus - :ivar start_time: The start time of the job. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the job. - :vartype end_time: ~datetime.datetime - :ivar last_modified_time: The last modified time of the job. - :vartype last_modified_time: ~datetime.datetime - :ivar provisioning_state: The provisioning state of a resource. - :vartype provisioning_state: str - :ivar run_on: Specifies the runOn group name where the job was executed. - :vartype run_on: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "runbook": {"readonly": True}, - "job_id": {"readonly": True}, - "creation_time": {"readonly": True}, - "status": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - "last_modified_time": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "runbook": {"key": "properties.runbook", "type": "RunbookAssociationProperty"}, - "job_id": {"key": "properties.jobId", "type": "str"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "status": {"key": "properties.status", "type": "str"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "end_time": {"key": "properties.endTime", "type": "iso-8601"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "run_on": {"key": "properties.runOn", "type": "str"}, - } - - def __init__(self, *, run_on: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword run_on: Specifies the runOn group name where the job was executed. - :paramtype run_on: str - """ - super().__init__(**kwargs) - 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 - - -class JobCreateParameters(_serialization.Model): - """The parameters supplied to the create job operation. - - :ivar runbook: Gets or sets the runbook. - :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty - :ivar parameters: Gets or sets the parameters of the job. - :vartype parameters: dict[str, str] - :ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be - executed. - :vartype run_on: str - """ - - _attribute_map = { - "runbook": {"key": "properties.runbook", "type": "RunbookAssociationProperty"}, - "parameters": {"key": "properties.parameters", "type": "{str}"}, - "run_on": {"key": "properties.runOn", "type": "str"}, - } - - def __init__( - self, - *, - runbook: Optional["_models.RunbookAssociationProperty"] = None, - parameters: Optional[dict[str, str]] = None, - run_on: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword runbook: Gets or sets the runbook. - :paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty - :keyword parameters: Gets or sets the parameters of the job. - :paramtype parameters: dict[str, str] - :keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be - executed. - :paramtype run_on: str - """ - super().__init__(**kwargs) - self.runbook = runbook - self.parameters = parameters - self.run_on = run_on - - -class JobListResultV2(_serialization.Model): - """The response model for the list job operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of jobs. - :vartype value: list[~azure.mgmt.automation.models.JobCollectionItem] - :ivar next_link: The link to the next page. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[JobCollectionItem]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - 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: Optional[str] = None - - -class JobNavigation(_serialization.Model): - """Software update configuration machine run job navigation properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Id of the job associated with the software update configuration run. - :vartype id: str - """ - - _validation = { - "id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - - -class JobSchedule(_serialization.Model): - """Definition of the job schedule. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Gets the id of the resource. - :vartype id: str - :ivar name: Gets the name of the variable. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar job_schedule_id: Gets or sets the id of job schedule. - :vartype job_schedule_id: str - :ivar schedule: Gets or sets the schedule. - :vartype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty - :ivar runbook: Gets or sets the runbook. - :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty - :ivar run_on: Gets or sets the hybrid worker group that the scheduled job should run on. - :vartype run_on: str - :ivar parameters: Gets or sets the parameters of the job schedule. - :vartype parameters: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "job_schedule_id": {"key": "properties.jobScheduleId", "type": "str"}, - "schedule": {"key": "properties.schedule", "type": "ScheduleAssociationProperty"}, - "runbook": {"key": "properties.runbook", "type": "RunbookAssociationProperty"}, - "run_on": {"key": "properties.runOn", "type": "str"}, - "parameters": {"key": "properties.parameters", "type": "{str}"}, - } - - def __init__( - self, - *, - job_schedule_id: Optional[str] = None, - schedule: Optional["_models.ScheduleAssociationProperty"] = None, - runbook: Optional["_models.RunbookAssociationProperty"] = None, - run_on: Optional[str] = None, - parameters: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword job_schedule_id: Gets or sets the id of job schedule. - :paramtype job_schedule_id: str - :keyword schedule: Gets or sets the schedule. - :paramtype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty - :keyword runbook: Gets or sets the runbook. - :paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty - :keyword run_on: Gets or sets the hybrid worker group that the scheduled job should run on. - :paramtype run_on: str - :keyword parameters: Gets or sets the parameters of the job schedule. - :paramtype parameters: dict[str, str] - """ - super().__init__(**kwargs) - 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 - self.run_on = run_on - self.parameters = parameters - - -class JobScheduleCreateParameters(_serialization.Model): - """The parameters supplied to the create job schedule operation. - - All required parameters must be populated in order to send to server. - - :ivar schedule: Gets or sets the schedule. Required. - :vartype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty - :ivar runbook: Gets or sets the runbook. Required. - :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty - :ivar run_on: Gets or sets the hybrid worker group that the scheduled job should run on. - :vartype run_on: str - :ivar parameters: Gets or sets a list of job properties. - :vartype parameters: dict[str, str] - """ - - _validation = { - "schedule": {"required": True}, - "runbook": {"required": True}, - } - - _attribute_map = { - "schedule": {"key": "properties.schedule", "type": "ScheduleAssociationProperty"}, - "runbook": {"key": "properties.runbook", "type": "RunbookAssociationProperty"}, - "run_on": {"key": "properties.runOn", "type": "str"}, - "parameters": {"key": "properties.parameters", "type": "{str}"}, - } - - def __init__( - self, - *, - schedule: "_models.ScheduleAssociationProperty", - runbook: "_models.RunbookAssociationProperty", - run_on: Optional[str] = None, - parameters: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword schedule: Gets or sets the schedule. Required. - :paramtype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty - :keyword runbook: Gets or sets the runbook. Required. - :paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty - :keyword run_on: Gets or sets the hybrid worker group that the scheduled job should run on. - :paramtype run_on: str - :keyword parameters: Gets or sets a list of job properties. - :paramtype parameters: dict[str, str] - """ - super().__init__(**kwargs) - self.schedule = schedule - self.runbook = runbook - self.run_on = run_on - self.parameters = parameters - - -class JobScheduleListResult(_serialization.Model): - """The response model for the list job schedule operation. - - :ivar value: Gets or sets a list of job schedules. - :vartype value: list[~azure.mgmt.automation.models.JobSchedule] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[JobSchedule]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.JobSchedule"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of job schedules. - :paramtype value: list[~azure.mgmt.automation.models.JobSchedule] - :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 JobStream(_serialization.Model): - """Definition of the job stream. - - :ivar id: Gets or sets the id of the resource. - :vartype id: str - :ivar job_stream_id: Gets or sets the id of the job stream. - :vartype job_stream_id: str - :ivar time: Gets or sets the creation time of the job. - :vartype time: ~datetime.datetime - :ivar stream_type: Gets or sets the stream type. Known values are: "Progress", "Output", - "Warning", "Error", "Debug", "Verbose", and "Any". - :vartype stream_type: str or ~azure.mgmt.automation.models.JobStreamType - :ivar stream_text: Gets or sets the stream text. - :vartype stream_text: str - :ivar summary: Gets or sets the summary. - :vartype summary: str - :ivar value: Gets or sets the values of the job stream. - :vartype value: dict[str, JSON] - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "job_stream_id": {"key": "properties.jobStreamId", "type": "str"}, - "time": {"key": "properties.time", "type": "iso-8601"}, - "stream_type": {"key": "properties.streamType", "type": "str"}, - "stream_text": {"key": "properties.streamText", "type": "str"}, - "summary": {"key": "properties.summary", "type": "str"}, - "value": {"key": "properties.value", "type": "{object}"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - job_stream_id: Optional[str] = None, - time: Optional[datetime.datetime] = None, - stream_type: Optional[Union[str, "_models.JobStreamType"]] = None, - stream_text: Optional[str] = None, - summary: Optional[str] = None, - value: Optional[dict[str, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Gets or sets the id of the resource. - :paramtype id: str - :keyword job_stream_id: Gets or sets the id of the job stream. - :paramtype job_stream_id: str - :keyword time: Gets or sets the creation time of the job. - :paramtype time: ~datetime.datetime - :keyword stream_type: Gets or sets the stream type. Known values are: "Progress", "Output", - "Warning", "Error", "Debug", "Verbose", and "Any". - :paramtype stream_type: str or ~azure.mgmt.automation.models.JobStreamType - :keyword stream_text: Gets or sets the stream text. - :paramtype stream_text: str - :keyword summary: Gets or sets the summary. - :paramtype summary: str - :keyword value: Gets or sets the values of the job stream. - :paramtype value: dict[str, JSON] - """ - super().__init__(**kwargs) - self.id = id - self.job_stream_id = job_stream_id - self.time = time - self.stream_type = stream_type - self.stream_text = stream_text - self.summary = summary - self.value = value - - -class JobStreamListResult(_serialization.Model): - """The response model for the list job stream operation. - - :ivar value: A list of job streams. - :vartype value: list[~azure.mgmt.automation.models.JobStream] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[JobStream]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.JobStream"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: A list of job streams. - :paramtype value: list[~azure.mgmt.automation.models.JobStream] - :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 Key(_serialization.Model): - """Automation key which is used to register a DSC Node. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_name: Automation key name. Known values are: "Primary" and "Secondary". - :vartype key_name: str or ~azure.mgmt.automation.models.AutomationKeyName - :ivar permissions: Automation key permissions. Known values are: "Read" and "Full". - :vartype permissions: str or ~azure.mgmt.automation.models.AutomationKeyPermissions - :ivar value: Value of the Automation Key used for registration. - :vartype value: str - """ - - _validation = { - "key_name": {"readonly": True}, - "permissions": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "key_name": {"key": "KeyName", "type": "str"}, - "permissions": {"key": "Permissions", "type": "str"}, - "value": {"key": "Value", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - 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): - """KeyListResult. - - :ivar keys: Lists the automation keys. - :vartype keys: list[~azure.mgmt.automation.models.Key] - """ - - _attribute_map = { - "keys": {"key": "keys", "type": "[Key]"}, - } - - 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] - """ - super().__init__(**kwargs) - self.keys = keys - - -class LinkedWorkspace(_serialization.Model): - """Definition of the linked workspace. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Gets the id of the linked workspace. - :vartype id: str - """ - - _validation = { - "id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - - -class LinuxProperties(_serialization.Model): - """Linux specific update configuration. - - :ivar included_package_classifications: Update classifications included in the software update - configuration. Known values are: "Unclassified", "Critical", "Security", and "Other". - :vartype included_package_classifications: str or - ~azure.mgmt.automation.models.LinuxUpdateClasses - :ivar excluded_package_name_masks: packages excluded from the software update configuration. - :vartype excluded_package_name_masks: list[str] - :ivar included_package_name_masks: packages included from the software update configuration. - :vartype included_package_name_masks: list[str] - :ivar reboot_setting: Reboot setting for the software update configuration. - :vartype reboot_setting: str - """ - - _attribute_map = { - "included_package_classifications": {"key": "includedPackageClassifications", "type": "str"}, - "excluded_package_name_masks": {"key": "excludedPackageNameMasks", "type": "[str]"}, - "included_package_name_masks": {"key": "includedPackageNameMasks", "type": "[str]"}, - "reboot_setting": {"key": "rebootSetting", "type": "str"}, - } - - 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, - reboot_setting: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword included_package_classifications: Update classifications included in the software - update configuration. Known values are: "Unclassified", "Critical", "Security", and "Other". - :paramtype included_package_classifications: str or - ~azure.mgmt.automation.models.LinuxUpdateClasses - :keyword excluded_package_name_masks: packages excluded from the software update configuration. - :paramtype excluded_package_name_masks: list[str] - :keyword included_package_name_masks: packages included from the software update configuration. - :paramtype included_package_name_masks: list[str] - :keyword reboot_setting: Reboot setting for the software update configuration. - :paramtype reboot_setting: str - """ - super().__init__(**kwargs) - self.included_package_classifications = included_package_classifications - self.excluded_package_name_masks = excluded_package_name_masks - self.included_package_name_masks = included_package_name_masks - self.reboot_setting = reboot_setting - - -class Module(TrackedResource): - """Definition of the module type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The Azure Region where the resource lives. - :vartype location: str - :ivar etag: Gets or sets the etag of the resource. - :vartype etag: str - :ivar is_global: Gets or sets the isGlobal flag of the module. - :vartype is_global: bool - :ivar version: Gets or sets the version of the module. - :vartype version: str - :ivar size_in_bytes: Gets or sets the size in bytes of the module. - :vartype size_in_bytes: int - :ivar activity_count: Gets or sets the activity count of the module. - :vartype activity_count: int - :ivar provisioning_state: Gets or sets the provisioning state of the module. Known values are: - "Created", "Creating", "StartingImportModuleRunbook", "RunningImportModuleRunbook", - "ContentRetrieved", "ContentDownloaded", "ContentValidated", "ConnectionTypeImported", - "ContentStored", "ModuleDataStored", "ActivitiesStored", "ModuleImportRunbookComplete", - "Succeeded", "Failed", "Cancelled", and "Updating". - :vartype provisioning_state: str or ~azure.mgmt.automation.models.ModuleProvisioningState - :ivar content_link: Gets or sets the contentLink of the module. - :vartype content_link: ~azure.mgmt.automation.models.ContentLink - :ivar error: Gets or sets the error info of the module. - :vartype error: ~azure.mgmt.automation.models.ModuleErrorInfo - :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 - :ivar is_composite: Gets or sets type of module, if its composite or not. - :vartype is_composite: bool - """ - - _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"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "is_global": {"key": "properties.isGlobal", "type": "bool"}, - "version": {"key": "properties.version", "type": "str"}, - "size_in_bytes": {"key": "properties.sizeInBytes", "type": "int"}, - "activity_count": {"key": "properties.activityCount", "type": "int"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "content_link": {"key": "properties.contentLink", "type": "ContentLink"}, - "error": {"key": "properties.error", "type": "ModuleErrorInfo"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "description": {"key": "properties.description", "type": "str"}, - "is_composite": {"key": "properties.isComposite", "type": "bool"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - location: Optional[str] = None, - etag: Optional[str] = None, - is_global: Optional[bool] = None, - version: Optional[str] = None, - size_in_bytes: Optional[int] = None, - activity_count: Optional[int] = None, - provisioning_state: Optional[Union[str, "_models.ModuleProvisioningState"]] = None, - content_link: Optional["_models.ContentLink"] = None, - error: Optional["_models.ModuleErrorInfo"] = None, - creation_time: Optional[datetime.datetime] = None, - last_modified_time: Optional[datetime.datetime] = None, - description: Optional[str] = None, - is_composite: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The Azure Region where the resource lives. - :paramtype location: str - :keyword etag: Gets or sets the etag of the resource. - :paramtype etag: str - :keyword is_global: Gets or sets the isGlobal flag of the module. - :paramtype is_global: bool - :keyword version: Gets or sets the version of the module. - :paramtype version: str - :keyword size_in_bytes: Gets or sets the size in bytes of the module. - :paramtype size_in_bytes: int - :keyword activity_count: Gets or sets the activity count of the module. - :paramtype activity_count: int - :keyword provisioning_state: Gets or sets the provisioning state of the module. Known values - are: "Created", "Creating", "StartingImportModuleRunbook", "RunningImportModuleRunbook", - "ContentRetrieved", "ContentDownloaded", "ContentValidated", "ConnectionTypeImported", - "ContentStored", "ModuleDataStored", "ActivitiesStored", "ModuleImportRunbookComplete", - "Succeeded", "Failed", "Cancelled", and "Updating". - :paramtype provisioning_state: str or ~azure.mgmt.automation.models.ModuleProvisioningState - :keyword content_link: Gets or sets the contentLink of the module. - :paramtype content_link: ~azure.mgmt.automation.models.ContentLink - :keyword error: Gets or sets the error info of the module. - :paramtype error: ~azure.mgmt.automation.models.ModuleErrorInfo - :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 - :keyword is_composite: Gets or sets type of module, if its composite or not. - :paramtype is_composite: bool - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag = etag - self.is_global = is_global - self.version = version - self.size_in_bytes = size_in_bytes - self.activity_count = activity_count - self.provisioning_state = provisioning_state - self.content_link = content_link - self.error = error - self.creation_time = creation_time - self.last_modified_time = last_modified_time - self.description = description - self.is_composite = is_composite - - -class ModuleCreateOrUpdateParameters(_serialization.Model): - """The parameters supplied to the create or update module operation. - - All required parameters must be populated in order to send to server. - - :ivar name: Gets or sets name of the resource. - :vartype name: str - :ivar location: Gets or sets the location of the resource. - :vartype location: str - :ivar tags: Gets or sets the tags attached to the resource. - :vartype tags: dict[str, str] - :ivar content_link: Gets or sets the module content link. Required. - :vartype content_link: ~azure.mgmt.automation.models.ContentLink - """ - - _validation = { - "content_link": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "content_link": {"key": "properties.contentLink", "type": "ContentLink"}, - } - - def __init__( - self, - *, - content_link: "_models.ContentLink", - name: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets name of the resource. - :paramtype name: str - :keyword location: Gets or sets the location of the resource. - :paramtype location: str - :keyword tags: Gets or sets the tags attached to the resource. - :paramtype tags: dict[str, str] - :keyword content_link: Gets or sets the module content link. Required. - :paramtype content_link: ~azure.mgmt.automation.models.ContentLink - """ - super().__init__(**kwargs) - self.name = name - self.location = location - self.tags = tags - self.content_link = content_link - - -class ModuleErrorInfo(_serialization.Model): - """Definition of the module error info type. - - :ivar code: Gets or sets the error code. - :vartype code: str - :ivar message: Gets or sets the error message. - :vartype message: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword code: Gets or sets the error code. - :paramtype code: str - :keyword message: Gets or sets the error message. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class ModuleListResult(_serialization.Model): - """The response model for the list module operation. - - :ivar value: Gets or sets a list of modules. - :vartype value: list[~azure.mgmt.automation.models.Module] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Module]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Module"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of modules. - :paramtype value: list[~azure.mgmt.automation.models.Module] - :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 ModuleUpdateParameters(_serialization.Model): - """The parameters supplied to the update module operation. - - :ivar name: Gets or sets name of the resource. - :vartype name: str - :ivar location: Gets or sets the location of the resource. - :vartype location: str - :ivar tags: Gets or sets the tags attached to the resource. - :vartype tags: dict[str, str] - :ivar content_link: Gets or sets the module content link. - :vartype content_link: ~azure.mgmt.automation.models.ContentLink - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "content_link": {"key": "properties.contentLink", "type": "ContentLink"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - content_link: Optional["_models.ContentLink"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets name of the resource. - :paramtype name: str - :keyword location: Gets or sets the location of the resource. - :paramtype location: str - :keyword tags: Gets or sets the tags attached to the resource. - :paramtype tags: dict[str, str] - :keyword content_link: Gets or sets the module content link. - :paramtype content_link: ~azure.mgmt.automation.models.ContentLink - """ - super().__init__(**kwargs) - self.name = name - self.location = location - self.tags = tags - self.content_link = content_link - - -class NodeCount(_serialization.Model): - """Number of nodes based on the Filter. - - :ivar name: Gets the name of a count type. - :vartype name: str - :ivar properties: - :vartype properties: ~azure.mgmt.automation.models.NodeCountProperties - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "properties": {"key": "properties", "type": "NodeCountProperties"}, - } - - def __init__( - self, *, name: Optional[str] = None, properties: Optional["_models.NodeCountProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword name: Gets the name of a count type. - :paramtype name: str - :keyword properties: - :paramtype properties: ~azure.mgmt.automation.models.NodeCountProperties - """ - super().__init__(**kwargs) - self.name = name - self.properties = properties - - -class NodeCountProperties(_serialization.Model): - """NodeCountProperties. - - :ivar count: Gets the count for the name. - :vartype count: int - """ - - _attribute_map = { - "count": {"key": "count", "type": "int"}, - } - - def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword count: Gets the count for the name. - :paramtype count: int - """ - super().__init__(**kwargs) - self.count = count - - -class NodeCounts(_serialization.Model): - """Gets the count of nodes by count type. - - :ivar value: Gets an array of counts. - :vartype value: list[~azure.mgmt.automation.models.NodeCount] - :ivar total_count: Gets the total number of records matching countType criteria. - :vartype total_count: int - """ - - _attribute_map = { - "value": {"key": "value", "type": "[NodeCount]"}, - "total_count": {"key": "totalCount", "type": "int"}, - } - - def __init__( - self, *, value: Optional[list["_models.NodeCount"]] = None, total_count: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets an array of counts. - :paramtype value: list[~azure.mgmt.automation.models.NodeCount] - :keyword total_count: Gets the total number of records matching countType criteria. - :paramtype total_count: int - """ - super().__init__(**kwargs) - self.value = value - self.total_count = total_count - - -class NonAzureQueryProperties(_serialization.Model): - """Non Azure query for the update configuration. - - :ivar function_alias: Log Analytics Saved Search name. - :vartype function_alias: str - :ivar workspace_id: Workspace Id for Log Analytics in which the saved Search is resided. - :vartype workspace_id: str - """ - - _attribute_map = { - "function_alias": {"key": "functionAlias", "type": "str"}, - "workspace_id": {"key": "workspaceId", "type": "str"}, - } - - def __init__( - self, *, function_alias: Optional[str] = None, workspace_id: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword function_alias: Log Analytics Saved Search name. - :paramtype function_alias: str - :keyword workspace_id: Workspace Id for Log Analytics in which the saved Search is resided. - :paramtype workspace_id: str - """ - super().__init__(**kwargs) - self.function_alias = function_alias - self.workspace_id = workspace_id - - -class Operation(_serialization.Model): - """Automation REST API operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: Provider, Resource and Operation values. - :vartype display: ~azure.mgmt.automation.models.OperationDisplay - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationDisplay"}, - } - - def __init__( - 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 - """ - super().__init__(**kwargs) - self.name = name - self.display = display - - -class OperationDisplay(_serialization.Model): - """Provider, Resource and Operation values. - - :ivar provider: Service provider: Microsoft.Automation. - :vartype provider: str - :ivar resource: Resource on which the operation is performed: Runbooks, Jobs etc. - :vartype resource: str - :ivar operation: Operation type: Read, write, delete, etc. - :vartype operation: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Service provider: Microsoft.Automation. - :paramtype provider: str - :keyword resource: Resource on which the operation is performed: Runbooks, Jobs etc. - :paramtype resource: str - :keyword operation: Operation type: Read, write, delete, etc. - :paramtype operation: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - - -class OperationListResult(_serialization.Model): - """The response model for the list of Automation operations. - - :ivar value: List of Automation operations supported by the Automation resource provider. - :vartype value: list[~azure.mgmt.automation.models.Operation] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - } - - 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] - """ - super().__init__(**kwargs) - self.value = value - - -class PythonPackageCreateParameters(_serialization.Model): - """The parameters supplied to the create or update module operation. - - All required parameters must be populated in order to send to server. - - :ivar tags: Gets or sets the tags attached to the resource. - :vartype tags: dict[str, str] - :ivar content_link: Gets or sets the module content link. Required. - :vartype content_link: ~azure.mgmt.automation.models.ContentLink - """ - - _validation = { - "content_link": {"required": True}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "content_link": {"key": "properties.contentLink", "type": "ContentLink"}, - } - - def __init__( - self, *, content_link: "_models.ContentLink", tags: Optional[dict[str, str]] = None, **kwargs: Any - ) -> None: - """ - :keyword tags: Gets or sets the tags attached to the resource. - :paramtype tags: dict[str, str] - :keyword content_link: Gets or sets the module content link. Required. - :paramtype content_link: ~azure.mgmt.automation.models.ContentLink - """ - super().__init__(**kwargs) - self.tags = tags - self.content_link = content_link - - -class PythonPackageUpdateParameters(_serialization.Model): - """The parameters supplied to the update module operation. - - :ivar tags: Gets or sets the tags attached to the resource. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Gets or sets the tags attached to the resource. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class RunAsCredentialAssociationProperty(_serialization.Model): - """Definition of RunAs credential to use for hybrid worker. - - :ivar name: Gets or sets the name of the credential. - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Gets or sets the name of the credential. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class Runbook(TrackedResource): - """Definition of the runbook type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The Azure Region where the resource lives. - :vartype location: str - :ivar etag: Gets or sets the etag of the resource. - :vartype etag: str - :ivar runbook_type: Gets or sets the type of the runbook. Known values are: "Script", "Graph", - "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", "Python2", - and "Python3". - :vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum - :ivar publish_content_link: Gets or sets the published runbook content link. - :vartype publish_content_link: ~azure.mgmt.automation.models.ContentLink - :ivar state: Gets or sets the state of the runbook. Known values are: "New", "Edit", and - "Published". - :vartype state: str or ~azure.mgmt.automation.models.RunbookState - :ivar log_verbose: Gets or sets verbose log option. - :vartype log_verbose: bool - :ivar log_progress: Gets or sets progress log option. - :vartype log_progress: bool - :ivar log_activity_trace: Gets or sets the option to log activity trace of the runbook. - :vartype log_activity_trace: int - :ivar job_count: Gets or sets the job count of the runbook. - :vartype job_count: int - :ivar parameters: Gets or sets the runbook parameters. - :vartype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter] - :ivar output_types: Gets or sets the runbook output types. - :vartype output_types: list[str] - :ivar draft: Gets or sets the draft runbook properties. - :vartype draft: ~azure.mgmt.automation.models.RunbookDraft - :ivar provisioning_state: Gets or sets the provisioning state of the runbook. Default value is - "Succeeded". - :vartype provisioning_state: str - :ivar last_modified_by: Gets or sets the last modified by. - :vartype last_modified_by: str - :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 = { - "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"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "runbook_type": {"key": "properties.runbookType", "type": "str"}, - "publish_content_link": {"key": "properties.publishContentLink", "type": "ContentLink"}, - "state": {"key": "properties.state", "type": "str"}, - "log_verbose": {"key": "properties.logVerbose", "type": "bool"}, - "log_progress": {"key": "properties.logProgress", "type": "bool"}, - "log_activity_trace": {"key": "properties.logActivityTrace", "type": "int"}, - "job_count": {"key": "properties.jobCount", "type": "int"}, - "parameters": {"key": "properties.parameters", "type": "{RunbookParameter}"}, - "output_types": {"key": "properties.outputTypes", "type": "[str]"}, - "draft": {"key": "properties.draft", "type": "RunbookDraft"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "last_modified_by": {"key": "properties.lastModifiedBy", "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"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - location: Optional[str] = None, - etag: Optional[str] = None, - runbook_type: Optional[Union[str, "_models.RunbookTypeEnum"]] = None, - publish_content_link: Optional["_models.ContentLink"] = None, - state: Optional[Union[str, "_models.RunbookState"]] = None, - log_verbose: Optional[bool] = None, - 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, - draft: Optional["_models.RunbookDraft"] = None, - provisioning_state: Optional[Literal["Succeeded"]] = None, - last_modified_by: Optional[str] = None, - creation_time: Optional[datetime.datetime] = None, - last_modified_time: Optional[datetime.datetime] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The Azure Region where the resource lives. - :paramtype location: str - :keyword etag: Gets or sets the etag of the resource. - :paramtype etag: str - :keyword runbook_type: Gets or sets the type of the runbook. Known values are: "Script", - "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", - "Python2", and "Python3". - :paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum - :keyword publish_content_link: Gets or sets the published runbook content link. - :paramtype publish_content_link: ~azure.mgmt.automation.models.ContentLink - :keyword state: Gets or sets the state of the runbook. Known values are: "New", "Edit", and - "Published". - :paramtype state: str or ~azure.mgmt.automation.models.RunbookState - :keyword log_verbose: Gets or sets verbose log option. - :paramtype log_verbose: bool - :keyword log_progress: Gets or sets progress log option. - :paramtype log_progress: bool - :keyword log_activity_trace: Gets or sets the option to log activity trace of the runbook. - :paramtype log_activity_trace: int - :keyword job_count: Gets or sets the job count of the runbook. - :paramtype job_count: int - :keyword parameters: Gets or sets the runbook parameters. - :paramtype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter] - :keyword output_types: Gets or sets the runbook output types. - :paramtype output_types: list[str] - :keyword draft: Gets or sets the draft runbook properties. - :paramtype draft: ~azure.mgmt.automation.models.RunbookDraft - :keyword provisioning_state: Gets or sets the provisioning state of the runbook. Default value - is "Succeeded". - :paramtype provisioning_state: str - :keyword last_modified_by: Gets or sets the last modified by. - :paramtype last_modified_by: str - :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__(tags=tags, location=location, **kwargs) - self.etag = etag - self.runbook_type = runbook_type - self.publish_content_link = publish_content_link - self.state = state - self.log_verbose = log_verbose - self.log_progress = log_progress - self.log_activity_trace = log_activity_trace - self.job_count = job_count - self.parameters = parameters - self.output_types = output_types - self.draft = draft - self.provisioning_state = provisioning_state - self.last_modified_by = last_modified_by - self.creation_time = creation_time - self.last_modified_time = last_modified_time - self.description = description - - -class RunbookAssociationProperty(_serialization.Model): - """The runbook property associated with the entity. - - :ivar name: Gets or sets the name of the runbook. - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Gets or sets the name of the runbook. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class RunbookCreateOrUpdateDraftParameters(_serialization.Model): - """The parameters supplied to the create or update runbook operation. - - All required parameters must be populated in order to send to server. - - :ivar runbook_content: Content of the Runbook. Required. - :vartype runbook_content: str - """ - - _validation = { - "runbook_content": {"required": True}, - } - - _attribute_map = { - "runbook_content": {"key": "runbookContent", "type": "str"}, - } - - def __init__(self, *, runbook_content: str, **kwargs: Any) -> None: - """ - :keyword runbook_content: Content of the Runbook. Required. - :paramtype runbook_content: str - """ - super().__init__(**kwargs) - self.runbook_content = runbook_content - - -class RunbookCreateOrUpdateDraftProperties(_serialization.Model): - """The parameters supplied to the create or update draft runbook properties. - - All required parameters must be populated in order to send to server. - - :ivar log_verbose: Gets or sets verbose log option. - :vartype log_verbose: bool - :ivar log_progress: Gets or sets progress log option. - :vartype log_progress: bool - :ivar runbook_type: Gets or sets the type of the runbook. Required. Known values are: "Script", - "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", - "Python2", and "Python3". - :vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum - :ivar draft: Gets or sets the draft runbook properties. Required. - :vartype draft: ~azure.mgmt.automation.models.RunbookDraft - :ivar description: Gets or sets the description of the runbook. - :vartype description: str - :ivar log_activity_trace: Gets or sets the activity-level tracing options of the runbook. - :vartype log_activity_trace: int - """ - - _validation = { - "runbook_type": {"required": True}, - "draft": {"required": True}, - } - - _attribute_map = { - "log_verbose": {"key": "logVerbose", "type": "bool"}, - "log_progress": {"key": "logProgress", "type": "bool"}, - "runbook_type": {"key": "runbookType", "type": "str"}, - "draft": {"key": "draft", "type": "RunbookDraft"}, - "description": {"key": "description", "type": "str"}, - "log_activity_trace": {"key": "logActivityTrace", "type": "int"}, - } - - def __init__( - self, - *, - runbook_type: Union[str, "_models.RunbookTypeEnum"], - draft: "_models.RunbookDraft", - log_verbose: Optional[bool] = None, - log_progress: Optional[bool] = None, - description: Optional[str] = None, - log_activity_trace: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_verbose: Gets or sets verbose log option. - :paramtype log_verbose: bool - :keyword log_progress: Gets or sets progress log option. - :paramtype log_progress: bool - :keyword runbook_type: Gets or sets the type of the runbook. Required. Known values are: - "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", - "GraphPowerShell", "Python2", and "Python3". - :paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum - :keyword draft: Gets or sets the draft runbook properties. Required. - :paramtype draft: ~azure.mgmt.automation.models.RunbookDraft - :keyword description: Gets or sets the description of the runbook. - :paramtype description: str - :keyword log_activity_trace: Gets or sets the activity-level tracing options of the runbook. - :paramtype log_activity_trace: int - """ - super().__init__(**kwargs) - self.log_verbose = log_verbose - self.log_progress = log_progress - self.runbook_type = runbook_type - self.draft = draft - self.description = description - self.log_activity_trace = log_activity_trace - - -class RunbookCreateOrUpdateParameters(_serialization.Model): - """The parameters supplied to the create or update runbook operation. - - All required parameters must be populated in order to send to server. - - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar location: Gets or sets the location of the resource. - :vartype location: str - :ivar tags: Gets or sets the tags attached to the resource. - :vartype tags: dict[str, str] - :ivar log_verbose: Gets or sets verbose log option. - :vartype log_verbose: bool - :ivar log_progress: Gets or sets progress log option. - :vartype log_progress: bool - :ivar runbook_type: Gets or sets the type of the runbook. Required. Known values are: "Script", - "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", - "Python2", and "Python3". - :vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum - :ivar draft: Gets or sets the draft runbook properties. - :vartype draft: ~azure.mgmt.automation.models.RunbookDraft - :ivar publish_content_link: Gets or sets the published runbook content link. - :vartype publish_content_link: ~azure.mgmt.automation.models.ContentLink - :ivar description: Gets or sets the description of the runbook. - :vartype description: str - :ivar log_activity_trace: Gets or sets the activity-level tracing options of the runbook. - :vartype log_activity_trace: int - """ - - _validation = { - "runbook_type": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "log_verbose": {"key": "properties.logVerbose", "type": "bool"}, - "log_progress": {"key": "properties.logProgress", "type": "bool"}, - "runbook_type": {"key": "properties.runbookType", "type": "str"}, - "draft": {"key": "properties.draft", "type": "RunbookDraft"}, - "publish_content_link": {"key": "properties.publishContentLink", "type": "ContentLink"}, - "description": {"key": "properties.description", "type": "str"}, - "log_activity_trace": {"key": "properties.logActivityTrace", "type": "int"}, - } - - def __init__( - self, - *, - runbook_type: Union[str, "_models.RunbookTypeEnum"], - name: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - log_verbose: Optional[bool] = None, - log_progress: Optional[bool] = None, - draft: Optional["_models.RunbookDraft"] = None, - publish_content_link: Optional["_models.ContentLink"] = None, - description: Optional[str] = None, - log_activity_trace: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the resource. - :paramtype name: str - :keyword location: Gets or sets the location of the resource. - :paramtype location: str - :keyword tags: Gets or sets the tags attached to the resource. - :paramtype tags: dict[str, str] - :keyword log_verbose: Gets or sets verbose log option. - :paramtype log_verbose: bool - :keyword log_progress: Gets or sets progress log option. - :paramtype log_progress: bool - :keyword runbook_type: Gets or sets the type of the runbook. Required. Known values are: - "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", - "GraphPowerShell", "Python2", and "Python3". - :paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum - :keyword draft: Gets or sets the draft runbook properties. - :paramtype draft: ~azure.mgmt.automation.models.RunbookDraft - :keyword publish_content_link: Gets or sets the published runbook content link. - :paramtype publish_content_link: ~azure.mgmt.automation.models.ContentLink - :keyword description: Gets or sets the description of the runbook. - :paramtype description: str - :keyword log_activity_trace: Gets or sets the activity-level tracing options of the runbook. - :paramtype log_activity_trace: int - """ - super().__init__(**kwargs) - self.name = name - self.location = location - self.tags = tags - self.log_verbose = log_verbose - self.log_progress = log_progress - self.runbook_type = runbook_type - self.draft = draft - self.publish_content_link = publish_content_link - self.description = description - self.log_activity_trace = log_activity_trace - - -class RunbookDraft(_serialization.Model): - """RunbookDraft. - - :ivar in_edit: Gets or sets whether runbook is in edit mode. - :vartype in_edit: bool - :ivar draft_content_link: Gets or sets the draft runbook content link. - :vartype draft_content_link: ~azure.mgmt.automation.models.ContentLink - :ivar creation_time: Gets or sets the creation time of the runbook draft. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Gets or sets the last modified time of the runbook draft. - :vartype last_modified_time: ~datetime.datetime - :ivar parameters: Gets or sets the runbook draft parameters. - :vartype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter] - :ivar output_types: Gets or sets the runbook output types. - :vartype output_types: list[str] - """ - - _attribute_map = { - "in_edit": {"key": "inEdit", "type": "bool"}, - "draft_content_link": {"key": "draftContentLink", "type": "ContentLink"}, - "creation_time": {"key": "creationTime", "type": "iso-8601"}, - "last_modified_time": {"key": "lastModifiedTime", "type": "iso-8601"}, - "parameters": {"key": "parameters", "type": "{RunbookParameter}"}, - "output_types": {"key": "outputTypes", "type": "[str]"}, - } - - def __init__( - self, - *, - in_edit: Optional[bool] = None, - 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, - **kwargs: Any - ) -> None: - """ - :keyword in_edit: Gets or sets whether runbook is in edit mode. - :paramtype in_edit: bool - :keyword draft_content_link: Gets or sets the draft runbook content link. - :paramtype draft_content_link: ~azure.mgmt.automation.models.ContentLink - :keyword creation_time: Gets or sets the creation time of the runbook draft. - :paramtype creation_time: ~datetime.datetime - :keyword last_modified_time: Gets or sets the last modified time of the runbook draft. - :paramtype last_modified_time: ~datetime.datetime - :keyword parameters: Gets or sets the runbook draft parameters. - :paramtype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter] - :keyword output_types: Gets or sets the runbook output types. - :paramtype output_types: list[str] - """ - super().__init__(**kwargs) - self.in_edit = in_edit - self.draft_content_link = draft_content_link - self.creation_time = creation_time - self.last_modified_time = last_modified_time - self.parameters = parameters - self.output_types = output_types - - -class RunbookDraftUndoEditResult(_serialization.Model): - """The response model for the undo edit runbook operation. - - :ivar status_code: Known values are: "Continue", "SwitchingProtocols", "OK", "Created", - "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", - "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", - "RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb", - "BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed", - "NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone", - "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", - "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", - "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", - and "HttpVersionNotSupported". - :vartype status_code: str or ~azure.mgmt.automation.models.HttpStatusCode - :ivar request_id: - :vartype request_id: str - """ - - _attribute_map = { - "status_code": {"key": "statusCode", "type": "str"}, - "request_id": {"key": "requestId", "type": "str"}, - } - - def __init__( - self, - *, - status_code: Optional[Union[str, "_models.HttpStatusCode"]] = None, - request_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword status_code: Known values are: "Continue", "SwitchingProtocols", "OK", "Created", - "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", - "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", - "RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb", - "BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed", - "NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone", - "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", - "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", - "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", - and "HttpVersionNotSupported". - :paramtype status_code: str or ~azure.mgmt.automation.models.HttpStatusCode - :keyword request_id: - :paramtype request_id: str - """ - super().__init__(**kwargs) - self.status_code = status_code - self.request_id = request_id - - -class RunbookListResult(_serialization.Model): - """The response model for the list runbook operation. - - :ivar value: Gets or sets a list of runbooks. - :vartype value: list[~azure.mgmt.automation.models.Runbook] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Runbook]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Runbook"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of runbooks. - :paramtype value: list[~azure.mgmt.automation.models.Runbook] - :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 RunbookParameter(_serialization.Model): - """Definition of the runbook parameter type. - - :ivar type: Gets or sets the type of the parameter. - :vartype type: str - :ivar is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is mandatory - or not. - :vartype is_mandatory: bool - :ivar position: Get or sets the position of the parameter. - :vartype position: int - :ivar default_value: Gets or sets the default value of parameter. - :vartype default_value: str - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "is_mandatory": {"key": "isMandatory", "type": "bool"}, - "position": {"key": "position", "type": "int"}, - "default_value": {"key": "defaultValue", "type": "str"}, - } - - def __init__( - self, - *, - type: Optional[str] = None, - is_mandatory: Optional[bool] = None, - position: Optional[int] = None, - default_value: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Gets or sets the type of the parameter. - :paramtype type: str - :keyword is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is - mandatory or not. - :paramtype is_mandatory: bool - :keyword position: Get or sets the position of the parameter. - :paramtype position: int - :keyword default_value: Gets or sets the default value of parameter. - :paramtype default_value: str - """ - super().__init__(**kwargs) - self.type = type - self.is_mandatory = is_mandatory - self.position = position - self.default_value = default_value - - -class RunbookUpdateParameters(_serialization.Model): - """The parameters supplied to the update runbook operation. - - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar location: Gets or sets the location of the resource. - :vartype location: str - :ivar tags: Gets or sets the tags attached to the resource. - :vartype tags: dict[str, str] - :ivar description: Gets or sets the description of the runbook. - :vartype description: str - :ivar log_verbose: Gets or sets verbose log option. - :vartype log_verbose: bool - :ivar log_progress: Gets or sets progress log option. - :vartype log_progress: bool - :ivar log_activity_trace: Gets or sets the activity-level tracing options of the runbook. - :vartype log_activity_trace: int - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "description": {"key": "properties.description", "type": "str"}, - "log_verbose": {"key": "properties.logVerbose", "type": "bool"}, - "log_progress": {"key": "properties.logProgress", "type": "bool"}, - "log_activity_trace": {"key": "properties.logActivityTrace", "type": "int"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - description: Optional[str] = None, - log_verbose: Optional[bool] = None, - log_progress: Optional[bool] = None, - log_activity_trace: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the resource. - :paramtype name: str - :keyword location: Gets or sets the location of the resource. - :paramtype location: str - :keyword tags: Gets or sets the tags attached to the resource. - :paramtype tags: dict[str, str] - :keyword description: Gets or sets the description of the runbook. - :paramtype description: str - :keyword log_verbose: Gets or sets verbose log option. - :paramtype log_verbose: bool - :keyword log_progress: Gets or sets progress log option. - :paramtype log_progress: bool - :keyword log_activity_trace: Gets or sets the activity-level tracing options of the runbook. - :paramtype log_activity_trace: int - """ - super().__init__(**kwargs) - self.name = name - self.location = location - self.tags = tags - self.description = description - self.log_verbose = log_verbose - self.log_progress = log_progress - self.log_activity_trace = log_activity_trace - - -class Schedule(ProxyResource): - """Definition of the schedule. - - 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 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: any - :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 = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "start_time_offset_minutes": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "start_time_offset_minutes": {"key": "properties.startTimeOffsetMinutes", "type": "float"}, - "expiry_time": {"key": "properties.expiryTime", "type": "iso-8601"}, - "expiry_time_offset_minutes": {"key": "properties.expiryTimeOffsetMinutes", "type": "float"}, - "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, - "next_run": {"key": "properties.nextRun", "type": "iso-8601"}, - "next_run_offset_minutes": {"key": "properties.nextRunOffsetMinutes", "type": "float"}, - "interval": {"key": "properties.interval", "type": "object"}, - "frequency": {"key": "properties.frequency", "type": "str"}, - "time_zone": {"key": "properties.timeZone", "type": "str"}, - "advanced_schedule": {"key": "properties.advancedSchedule", "type": "AdvancedSchedule"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "description": {"key": "properties.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[Any] = 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: any - :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 ScheduleAssociationProperty(_serialization.Model): - """The schedule property associated with the entity. - - :ivar name: Gets or sets the name of the Schedule. - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Gets or sets the name of the Schedule. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class ScheduleCreateOrUpdateParameters(_serialization.Model): - """The parameters supplied to the create or update schedule operation. - - All required parameters must be populated in order to send to server. - - :ivar name: Gets or sets the name of the Schedule. Required. - :vartype name: str - :ivar description: Gets or sets the description of the schedule. - :vartype description: str - :ivar start_time: Gets or sets the start time of the schedule. Required. - :vartype start_time: ~datetime.datetime - :ivar expiry_time: Gets or sets the end time of the schedule. - :vartype expiry_time: ~datetime.datetime - :ivar interval: Gets or sets the interval of the schedule. - :vartype interval: any - :ivar frequency: Gets or sets the frequency of the schedule. Required. 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 AdvancedSchedule. - :vartype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule - """ - - _validation = { - "name": {"required": True}, - "start_time": {"required": True}, - "frequency": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "expiry_time": {"key": "properties.expiryTime", "type": "iso-8601"}, - "interval": {"key": "properties.interval", "type": "object"}, - "frequency": {"key": "properties.frequency", "type": "str"}, - "time_zone": {"key": "properties.timeZone", "type": "str"}, - "advanced_schedule": {"key": "properties.advancedSchedule", "type": "AdvancedSchedule"}, - } - - def __init__( - self, - *, - name: str, - start_time: datetime.datetime, - frequency: Union[str, "_models.ScheduleFrequency"], - description: Optional[str] = None, - expiry_time: Optional[datetime.datetime] = None, - interval: Optional[Any] = None, - time_zone: Optional[str] = None, - advanced_schedule: Optional["_models.AdvancedSchedule"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the Schedule. Required. - :paramtype name: str - :keyword description: Gets or sets the description of the schedule. - :paramtype description: str - :keyword start_time: Gets or sets the start time of the schedule. Required. - :paramtype start_time: ~datetime.datetime - :keyword expiry_time: Gets or sets the end time of the schedule. - :paramtype expiry_time: ~datetime.datetime - :keyword interval: Gets or sets the interval of the schedule. - :paramtype interval: any - :keyword frequency: Gets or sets the frequency of the schedule. Required. 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 AdvancedSchedule. - :paramtype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule - """ - super().__init__(**kwargs) - self.name = name - self.description = description - self.start_time = start_time - self.expiry_time = expiry_time - self.interval = interval - self.frequency = frequency - self.time_zone = time_zone - self.advanced_schedule = advanced_schedule - - -class ScheduleListResult(_serialization.Model): - """The response model for the list schedule operation. - - :ivar value: Gets or sets a list of schedules. - :vartype value: list[~azure.mgmt.automation.models.Schedule] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Schedule]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Schedule"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of schedules. - :paramtype value: list[~azure.mgmt.automation.models.Schedule] - :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 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. - - :ivar name: Gets or sets the name of the Schedule. - :vartype name: str - :ivar description: Gets or sets the description of the schedule. - :vartype description: str - :ivar is_enabled: Gets or sets a value indicating whether this schedule is enabled. - :vartype is_enabled: bool - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - description: Optional[str] = None, - is_enabled: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the Schedule. - :paramtype name: str - :keyword description: Gets or sets the description of the schedule. - :paramtype description: str - :keyword is_enabled: Gets or sets a value indicating whether this schedule is enabled. - :paramtype is_enabled: bool - """ - super().__init__(**kwargs) - self.name = name - self.description = description - self.is_enabled = is_enabled - - -class Sku(_serialization.Model): - """The account SKU. - - All required parameters must be populated in order to send to server. - - :ivar name: Gets or sets the SKU name of the account. Required. Known values are: "Free" and - "Basic". - :vartype name: str or ~azure.mgmt.automation.models.SkuNameEnum - :ivar family: Gets or sets the SKU family. - :vartype family: str - :ivar capacity: Gets or sets the SKU capacity. - :vartype capacity: int - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "family": {"key": "family", "type": "str"}, - "capacity": {"key": "capacity", "type": "int"}, - } - - def __init__( - self, - *, - 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 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.pre_task = pre_task - self.post_task = post_task - - -class SoftwareUpdateConfiguration(_serialization.Model): - """Software update configuration properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar name: Resource name. - :vartype name: str - :ivar id: Resource Id. - :vartype id: str - :ivar type: Resource type. - :vartype type: str - :ivar update_configuration: update specific properties for the Software update configuration. - 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.ScheduleProperties - :ivar provisioning_state: Provisioning state for the software update configuration, which only - appears in the response. - :vartype provisioning_state: str - :ivar error: Details of provisioning error. - :vartype error: ~azure.mgmt.automation.models.ErrorResponse - :ivar creation_time: Creation time of the resource, which only appears in the response. - :vartype creation_time: ~datetime.datetime - :ivar created_by: CreatedBy property, which only appears in the response. - :vartype created_by: str - :ivar last_modified_time: Last time resource was modified, which only appears in the response. - :vartype last_modified_time: ~datetime.datetime - :ivar last_modified_by: LastModifiedBy property, which only appears in the response. - :vartype last_modified_by: str - :ivar tasks: Tasks information for the Software update configuration. - :vartype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks - """ - - _validation = { - "name": {"readonly": True}, - "id": {"readonly": True}, - "type": {"readonly": True}, - "update_configuration": {"required": True}, - "schedule_info": {"required": True}, - "provisioning_state": {"readonly": True}, - "creation_time": {"readonly": True}, - "created_by": {"readonly": True}, - "last_modified_time": {"readonly": True}, - "last_modified_by": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "update_configuration": {"key": "properties.updateConfiguration", "type": "UpdateConfiguration"}, - "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"}, - "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": "SoftwareUpdateConfigurationTasks"}, - } - - def __init__( - self, - *, - update_configuration: "_models.UpdateConfiguration", - schedule_info: "_models.ScheduleProperties", - error: Optional["_models.ErrorResponse"] = None, - tasks: Optional["_models.SoftwareUpdateConfigurationTasks"] = None, - **kwargs: Any - ) -> None: - """ - :keyword update_configuration: update specific properties for the Software update - 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.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: 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: Optional[str] = None - self.error = error - 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 - - -class SoftwareUpdateConfigurationCollectionItem(_serialization.Model): # pylint: disable=name-too-long - """Software update configuration collection item properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the software update configuration. - :vartype name: str - :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.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 - :ivar start_time: the start time of the update. - :vartype start_time: ~datetime.datetime - :ivar creation_time: Creation time of the software update configuration, which only appears in - the response. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Last time software update configuration was modified, which only - appears in the response. - :vartype last_modified_time: ~datetime.datetime - :ivar provisioning_state: Provisioning state for the software update configuration, which only - appears in the response. - :vartype provisioning_state: str - :ivar next_run: ext run time of the update. - :vartype next_run: ~datetime.datetime - """ - - _validation = { - "name": {"readonly": True}, - "id": {"readonly": True}, - "creation_time": {"readonly": True}, - "last_modified_time": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "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"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "next_run": {"key": "properties.nextRun", "type": "iso-8601"}, - } - - def __init__( - self, - *, - 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, - **kwargs: Any - ) -> None: - """ - :keyword update_configuration: Update specific properties of the software update configuration. - :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 - :keyword start_time: the start time of the update. - :paramtype start_time: ~datetime.datetime - :keyword next_run: ext run time of the update. - :paramtype next_run: ~datetime.datetime - """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.id: Optional[str] = None - self.update_configuration = update_configuration - self.frequency = frequency - self.start_time = start_time - 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 - - -class SoftwareUpdateConfigurationListResult(_serialization.Model): - """result of listing all software update configuration. - - :ivar value: outer object returned when listing all software update configurations. - :vartype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationCollectionItem] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SoftwareUpdateConfigurationCollectionItem]"}, - } - - def __init__( - self, *, value: Optional[list["_models.SoftwareUpdateConfigurationCollectionItem"]] = None, **kwargs: Any - ) -> None: - """ - :keyword value: outer object returned when listing all software update configurations. - :paramtype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationCollectionItem] - """ - super().__init__(**kwargs) - self.value = value - - -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. - - :ivar name: Name of the software update configuration machine run. - :vartype name: str - :ivar id: Resource Id of the software update configuration machine run. - :vartype id: str - :ivar target_computer: name of the updated computer. - :vartype target_computer: str - :ivar target_computer_type: type of the updated computer. - :vartype target_computer_type: str - :ivar software_update_configuration: software update configuration triggered this run. - :vartype software_update_configuration: - ~azure.mgmt.automation.models.UpdateConfigurationNavigation - :ivar status: Status of the software update configuration machine run. - :vartype status: str - :ivar os_type: Operating system target of the software update configuration triggered this run. - :vartype os_type: str - :ivar correlation_id: correlation id of the software update configuration machine run. - :vartype correlation_id: str - :ivar source_computer_id: source computer id of the software update configuration machine run. - :vartype source_computer_id: str - :ivar start_time: Start time of the software update configuration machine run. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the software update configuration machine run. - :vartype end_time: ~datetime.datetime - :ivar configured_duration: configured duration for the software update configuration run. - :vartype configured_duration: str - :ivar job: Job associated with the software update configuration machine run. - :vartype job: ~azure.mgmt.automation.models.JobNavigation - :ivar creation_time: Creation time of the resource, which only appears in the response. - :vartype creation_time: ~datetime.datetime - :ivar created_by: createdBy property, which only appears in the response. - :vartype created_by: str - :ivar last_modified_time: Last time resource was modified, which only appears in the response. - :vartype last_modified_time: ~datetime.datetime - :ivar last_modified_by: lastModifiedBy property, which only appears in the response. - :vartype last_modified_by: str - :ivar error: Details of provisioning error. - :vartype error: ~azure.mgmt.automation.models.ErrorResponse - """ - - _validation = { - "name": {"readonly": True}, - "id": {"readonly": True}, - "target_computer": {"readonly": True}, - "target_computer_type": {"readonly": True}, - "status": {"readonly": True}, - "os_type": {"readonly": True}, - "correlation_id": {"readonly": True}, - "source_computer_id": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - "configured_duration": {"readonly": True}, - "creation_time": {"readonly": True}, - "created_by": {"readonly": True}, - "last_modified_time": {"readonly": True}, - "last_modified_by": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "target_computer": {"key": "properties.targetComputer", "type": "str"}, - "target_computer_type": {"key": "properties.targetComputerType", "type": "str"}, - "software_update_configuration": { - "key": "properties.softwareUpdateConfiguration", - "type": "UpdateConfigurationNavigation", - }, - "status": {"key": "properties.status", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "correlation_id": {"key": "properties.correlationId", "type": "str"}, - "source_computer_id": {"key": "properties.sourceComputerId", "type": "str"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "end_time": {"key": "properties.endTime", "type": "iso-8601"}, - "configured_duration": {"key": "properties.configuredDuration", "type": "str"}, - "job": {"key": "properties.job", "type": "JobNavigation"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "created_by": {"key": "properties.createdBy", "type": "str"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "last_modified_by": {"key": "properties.lastModifiedBy", "type": "str"}, - "error": {"key": "properties.error", "type": "ErrorResponse"}, - } - - def __init__( - self, - *, - software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = None, - job: Optional["_models.JobNavigation"] = None, - error: Optional["_models.ErrorResponse"] = None, - **kwargs: Any - ) -> None: - """ - :keyword software_update_configuration: software update configuration triggered this run. - :paramtype software_update_configuration: - ~azure.mgmt.automation.models.UpdateConfigurationNavigation - :keyword job: Job associated with the software update configuration machine run. - :paramtype job: ~azure.mgmt.automation.models.JobNavigation - :keyword error: Details of provisioning error. - :paramtype error: ~azure.mgmt.automation.models.ErrorResponse - """ - super().__init__(**kwargs) - 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: 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: 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 - - -class SoftwareUpdateConfigurationMachineRunListResult(_serialization.Model): # pylint: disable=name-too-long - """result of listing all software update configuration machine runs. - - :ivar value: outer object returned when listing all software update configuration machine runs. - :vartype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun] - :ivar next_link: link to next page of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SoftwareUpdateConfigurationMachineRun]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.SoftwareUpdateConfigurationMachineRun"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: outer object returned when listing all software update configuration machine - runs. - :paramtype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun] - :keyword next_link: link to next page of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SoftwareUpdateConfigurationRun(_serialization.Model): - """Software update configuration Run properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the software update configuration run. - :vartype name: str - :ivar id: Resource Id of the software update configuration run. - :vartype id: str - :ivar software_update_configuration: software update configuration triggered this run. - :vartype software_update_configuration: - ~azure.mgmt.automation.models.UpdateConfigurationNavigation - :ivar status: Status of the software update configuration run. - :vartype status: str - :ivar configured_duration: Configured duration for the software update configuration run. - :vartype configured_duration: str - :ivar os_type: Operating system target of the software update configuration triggered this run. - :vartype os_type: str - :ivar start_time: Start time of the software update configuration run. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the software update configuration run. - :vartype end_time: ~datetime.datetime - :ivar computer_count: Number of computers in the software update configuration run. - :vartype computer_count: int - :ivar failed_count: Number of computers with failed status. - :vartype failed_count: int - :ivar creation_time: Creation time of the resource, which only appears in the response. - :vartype creation_time: ~datetime.datetime - :ivar created_by: CreatedBy property, which only appears in the response. - :vartype created_by: str - :ivar last_modified_time: Last time resource was modified, which only appears in the response. - :vartype last_modified_time: ~datetime.datetime - :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.SoftareUpdateConfigurationRunTasks - """ - - _validation = { - "name": {"readonly": True}, - "id": {"readonly": True}, - "status": {"readonly": True}, - "configured_duration": {"readonly": True}, - "os_type": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - "computer_count": {"readonly": True}, - "failed_count": {"readonly": True}, - "creation_time": {"readonly": True}, - "created_by": {"readonly": True}, - "last_modified_time": {"readonly": True}, - "last_modified_by": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "software_update_configuration": { - "key": "properties.softwareUpdateConfiguration", - "type": "UpdateConfigurationNavigation", - }, - "status": {"key": "properties.status", "type": "str"}, - "configured_duration": {"key": "properties.configuredDuration", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "end_time": {"key": "properties.endTime", "type": "iso-8601"}, - "computer_count": {"key": "properties.computerCount", "type": "int"}, - "failed_count": {"key": "properties.failedCount", "type": "int"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "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": "SoftareUpdateConfigurationRunTasks"}, - } - - def __init__( - self, - *, - software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = None, - tasks: Optional["_models.SoftareUpdateConfigurationRunTasks"] = None, - **kwargs: Any - ) -> None: - """ - :keyword software_update_configuration: software update configuration triggered this run. - :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.SoftareUpdateConfigurationRunTasks - """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.id: Optional[str] = None - self.software_update_configuration = software_update_configuration - 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 - - -class SoftwareUpdateConfigurationRunListResult(_serialization.Model): - """result of listing all software update configuration runs. - - :ivar value: outer object returned when listing all software update configuration runs. - :vartype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun] - :ivar next_link: link to next page of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SoftwareUpdateConfigurationRun]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.SoftwareUpdateConfigurationRun"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: outer object returned when listing all software update configuration runs. - :paramtype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun] - :keyword next_link: link to next page of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SoftwareUpdateConfigurationTasks(_serialization.Model): - """Task properties of the software update configuration. - - :ivar pre_task: Pre task properties. - :vartype pre_task: ~azure.mgmt.automation.models.TaskProperties - :ivar post_task: Post task properties. - :vartype post_task: ~azure.mgmt.automation.models.TaskProperties - """ - - _attribute_map = { - "pre_task": {"key": "preTask", "type": "TaskProperties"}, - "post_task": {"key": "postTask", "type": "TaskProperties"}, - } - - def __init__( - self, - *, - pre_task: Optional["_models.TaskProperties"] = None, - post_task: Optional["_models.TaskProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword pre_task: Pre task properties. - :paramtype pre_task: ~azure.mgmt.automation.models.TaskProperties - :keyword post_task: Post task properties. - :paramtype post_task: ~azure.mgmt.automation.models.TaskProperties - """ - super().__init__(**kwargs) - self.pre_task = pre_task - self.post_task = post_task - - -class SourceControl(ProxyResource): - """Definition of the source control. - - 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 repo_url: The repo url of the source control. - :vartype repo_url: str - :ivar branch: The repo branch of the source control. Include branch as empty string for - VsoTfvc. - :vartype branch: str - :ivar folder_path: The folder path of the source control. - :vartype folder_path: str - :ivar auto_sync: The auto sync of the source control. Default is false. - :vartype auto_sync: bool - :ivar publish_runbook: The auto publish of the source control. Default is true. - :vartype publish_runbook: bool - :ivar source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub. Known values are: - "VsoGit", "VsoTfvc", and "GitHub". - :vartype source_type: str or ~azure.mgmt.automation.models.SourceType - :ivar description: The description. - :vartype description: str - :ivar creation_time: The creation time. - :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: The last modified time. - :vartype last_modified_time: ~datetime.datetime - """ - - _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"}, - "repo_url": {"key": "properties.repoUrl", "type": "str"}, - "branch": {"key": "properties.branch", "type": "str"}, - "folder_path": {"key": "properties.folderPath", "type": "str"}, - "auto_sync": {"key": "properties.autoSync", "type": "bool"}, - "publish_runbook": {"key": "properties.publishRunbook", "type": "bool"}, - "source_type": {"key": "properties.sourceType", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - } - - def __init__( - self, - *, - repo_url: Optional[str] = None, - branch: Optional[str] = None, - folder_path: Optional[str] = None, - auto_sync: Optional[bool] = None, - publish_runbook: Optional[bool] = None, - source_type: Optional[Union[str, "_models.SourceType"]] = None, - description: Optional[str] = None, - creation_time: Optional[datetime.datetime] = None, - last_modified_time: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword repo_url: The repo url of the source control. - :paramtype repo_url: str - :keyword branch: The repo branch of the source control. Include branch as empty string for - VsoTfvc. - :paramtype branch: str - :keyword folder_path: The folder path of the source control. - :paramtype folder_path: str - :keyword auto_sync: The auto sync of the source control. Default is false. - :paramtype auto_sync: bool - :keyword publish_runbook: The auto publish of the source control. Default is true. - :paramtype publish_runbook: bool - :keyword source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub. Known values - are: "VsoGit", "VsoTfvc", and "GitHub". - :paramtype source_type: str or ~azure.mgmt.automation.models.SourceType - :keyword description: The description. - :paramtype description: str - :keyword creation_time: The creation time. - :paramtype creation_time: ~datetime.datetime - :keyword last_modified_time: The last modified time. - :paramtype last_modified_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.repo_url = repo_url - self.branch = branch - self.folder_path = folder_path - self.auto_sync = auto_sync - self.publish_runbook = publish_runbook - self.source_type = source_type - self.description = description - self.creation_time = creation_time - self.last_modified_time = last_modified_time - - -class SourceControlCreateOrUpdateParameters(_serialization.Model): - """The parameters supplied to the create or update source control operation. - - :ivar repo_url: The repo url of the source control. - :vartype repo_url: str - :ivar branch: The repo branch of the source control. Include branch as empty string for - VsoTfvc. - :vartype branch: str - :ivar folder_path: The folder path of the source control. Path must be relative. - :vartype folder_path: str - :ivar auto_sync: The auto async of the source control. Default is false. - :vartype auto_sync: bool - :ivar publish_runbook: The auto publish of the source control. Default is true. - :vartype publish_runbook: bool - :ivar source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub, case sensitive. - Known values are: "VsoGit", "VsoTfvc", and "GitHub". - :vartype source_type: str or ~azure.mgmt.automation.models.SourceType - :ivar security_token: The authorization token for the repo of the source control. - :vartype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties - :ivar description: The user description of the source control. - :vartype description: str - """ - - _validation = { - "repo_url": {"max_length": 2000}, - "branch": {"max_length": 255}, - "folder_path": {"max_length": 255}, - "description": {"max_length": 512}, - } - - _attribute_map = { - "repo_url": {"key": "properties.repoUrl", "type": "str"}, - "branch": {"key": "properties.branch", "type": "str"}, - "folder_path": {"key": "properties.folderPath", "type": "str"}, - "auto_sync": {"key": "properties.autoSync", "type": "bool"}, - "publish_runbook": {"key": "properties.publishRunbook", "type": "bool"}, - "source_type": {"key": "properties.sourceType", "type": "str"}, - "security_token": {"key": "properties.securityToken", "type": "SourceControlSecurityTokenProperties"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, - *, - repo_url: Optional[str] = None, - branch: Optional[str] = None, - folder_path: Optional[str] = None, - auto_sync: Optional[bool] = None, - publish_runbook: Optional[bool] = None, - source_type: Optional[Union[str, "_models.SourceType"]] = None, - security_token: Optional["_models.SourceControlSecurityTokenProperties"] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword repo_url: The repo url of the source control. - :paramtype repo_url: str - :keyword branch: The repo branch of the source control. Include branch as empty string for - VsoTfvc. - :paramtype branch: str - :keyword folder_path: The folder path of the source control. Path must be relative. - :paramtype folder_path: str - :keyword auto_sync: The auto async of the source control. Default is false. - :paramtype auto_sync: bool - :keyword publish_runbook: The auto publish of the source control. Default is true. - :paramtype publish_runbook: bool - :keyword source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub, case sensitive. - Known values are: "VsoGit", "VsoTfvc", and "GitHub". - :paramtype source_type: str or ~azure.mgmt.automation.models.SourceType - :keyword security_token: The authorization token for the repo of the source control. - :paramtype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties - :keyword description: The user description of the source control. - :paramtype description: str - """ - super().__init__(**kwargs) - self.repo_url = repo_url - self.branch = branch - self.folder_path = folder_path - self.auto_sync = auto_sync - self.publish_runbook = publish_runbook - self.source_type = source_type - self.security_token = security_token - self.description = description - - -class SourceControlListResult(_serialization.Model): - """The response model for the list source controls operation. - - :ivar value: The list of source controls. - :vartype value: list[~azure.mgmt.automation.models.SourceControl] - :ivar next_link: The next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SourceControl]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.SourceControl"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of source controls. - :paramtype value: list[~azure.mgmt.automation.models.SourceControl] - :keyword next_link: The next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SourceControlSecurityTokenProperties(_serialization.Model): - """SourceControlSecurityTokenProperties. - - :ivar access_token: The access token. - :vartype access_token: str - :ivar refresh_token: The refresh token. - :vartype refresh_token: str - :ivar token_type: The token type. Must be either PersonalAccessToken or Oauth. Known values - are: "PersonalAccessToken" and "Oauth". - :vartype token_type: str or ~azure.mgmt.automation.models.TokenType - """ - - _validation = { - "access_token": {"max_length": 1024}, - "refresh_token": {"max_length": 1024}, - } - - _attribute_map = { - "access_token": {"key": "accessToken", "type": "str"}, - "refresh_token": {"key": "refreshToken", "type": "str"}, - "token_type": {"key": "tokenType", "type": "str"}, - } - - def __init__( - self, - *, - access_token: Optional[str] = None, - refresh_token: Optional[str] = None, - token_type: Optional[Union[str, "_models.TokenType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword access_token: The access token. - :paramtype access_token: str - :keyword refresh_token: The refresh token. - :paramtype refresh_token: str - :keyword token_type: The token type. Must be either PersonalAccessToken or Oauth. Known values - are: "PersonalAccessToken" and "Oauth". - :paramtype token_type: str or ~azure.mgmt.automation.models.TokenType - """ - super().__init__(**kwargs) - self.access_token = access_token - self.refresh_token = refresh_token - self.token_type = token_type - - -class SourceControlSyncJob(_serialization.Model): - """Definition of the source control sync job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar id: Resource id. - :vartype id: str - :ivar source_control_sync_job_id: The source control sync job id. - :vartype source_control_sync_job_id: str - :ivar creation_time: The creation time of the job. - :vartype creation_time: ~datetime.datetime - :ivar provisioning_state: The provisioning state of the job. Known values are: "Completed", - "Failed", and "Running". - :vartype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState - :ivar start_time: The start time of the job. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the job. - :vartype end_time: ~datetime.datetime - :ivar sync_type: The sync type. Known values are: "PartialSync" and "FullSync". - :vartype sync_type: str or ~azure.mgmt.automation.models.SyncType - """ - - _validation = { - "name": {"readonly": True}, - "type": {"readonly": True}, - "id": {"readonly": True}, - "creation_time": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "source_control_sync_job_id": {"key": "properties.sourceControlSyncJobId", "type": "str"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "end_time": {"key": "properties.endTime", "type": "iso-8601"}, - "sync_type": {"key": "properties.syncType", "type": "str"}, - } - - def __init__( - self, - *, - source_control_sync_job_id: Optional[str] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - sync_type: Optional[Union[str, "_models.SyncType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_control_sync_job_id: The source control sync job id. - :paramtype source_control_sync_job_id: str - :keyword provisioning_state: The provisioning state of the job. Known values are: "Completed", - "Failed", and "Running". - :paramtype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState - :keyword sync_type: The sync type. Known values are: "PartialSync" and "FullSync". - :paramtype sync_type: str or ~azure.mgmt.automation.models.SyncType - """ - super().__init__(**kwargs) - 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: Optional[datetime.datetime] = None - self.provisioning_state = provisioning_state - self.start_time: Optional[datetime.datetime] = None - self.end_time: Optional[datetime.datetime] = None - self.sync_type = sync_type - - -class SourceControlSyncJobById(_serialization.Model): - """Definition of the source control sync job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The id of the job. - :vartype id: str - :ivar source_control_sync_job_id: The source control sync job id. - :vartype source_control_sync_job_id: str - :ivar creation_time: The creation time of the job. - :vartype creation_time: ~datetime.datetime - :ivar provisioning_state: The provisioning state of the job. Known values are: "Completed", - "Failed", and "Running". - :vartype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState - :ivar start_time: The start time of the job. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the job. - :vartype end_time: ~datetime.datetime - :ivar sync_type: The sync type. Known values are: "PartialSync" and "FullSync". - :vartype sync_type: str or ~azure.mgmt.automation.models.SyncType - :ivar exception: The exceptions that occurred while running the sync job. - :vartype exception: str - """ - - _validation = { - "creation_time": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "source_control_sync_job_id": {"key": "properties.sourceControlSyncJobId", "type": "str"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "end_time": {"key": "properties.endTime", "type": "iso-8601"}, - "sync_type": {"key": "properties.syncType", "type": "str"}, - "exception": {"key": "properties.exception", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - source_control_sync_job_id: Optional[str] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - sync_type: Optional[Union[str, "_models.SyncType"]] = None, - exception: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the job. - :paramtype id: str - :keyword source_control_sync_job_id: The source control sync job id. - :paramtype source_control_sync_job_id: str - :keyword provisioning_state: The provisioning state of the job. Known values are: "Completed", - "Failed", and "Running". - :paramtype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState - :keyword sync_type: The sync type. Known values are: "PartialSync" and "FullSync". - :paramtype sync_type: str or ~azure.mgmt.automation.models.SyncType - :keyword exception: The exceptions that occurred while running the sync job. - :paramtype exception: str - """ - super().__init__(**kwargs) - self.id = id - self.source_control_sync_job_id = source_control_sync_job_id - self.creation_time: Optional[datetime.datetime] = None - self.provisioning_state = provisioning_state - self.start_time: Optional[datetime.datetime] = None - self.end_time: Optional[datetime.datetime] = None - self.sync_type = sync_type - self.exception = exception - - -class SourceControlSyncJobCreateParameters(_serialization.Model): - """The parameters supplied to the create source control sync job operation. - - All required parameters must be populated in order to send to server. - - :ivar commit_id: The commit id of the source control sync job. If not syncing to a commitId, - enter an empty string. Required. - :vartype commit_id: str - """ - - _validation = { - "commit_id": {"required": True}, - } - - _attribute_map = { - "commit_id": {"key": "properties.commitId", "type": "str"}, - } - - def __init__(self, *, commit_id: str, **kwargs: Any) -> None: - """ - :keyword commit_id: The commit id of the source control sync job. If not syncing to a commitId, - enter an empty string. Required. - :paramtype commit_id: str - """ - super().__init__(**kwargs) - self.commit_id = commit_id - - -class SourceControlSyncJobListResult(_serialization.Model): - """The response model for the list source control sync jobs operation. - - :ivar value: The list of source control sync jobs. - :vartype value: list[~azure.mgmt.automation.models.SourceControlSyncJob] - :ivar next_link: The next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SourceControlSyncJob]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.SourceControlSyncJob"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of source control sync jobs. - :paramtype value: list[~azure.mgmt.automation.models.SourceControlSyncJob] - :keyword next_link: The next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SourceControlSyncJobStream(_serialization.Model): - """Definition of the source control sync job stream. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource id. - :vartype id: str - :ivar source_control_sync_job_stream_id: The sync job stream id. - :vartype source_control_sync_job_stream_id: str - :ivar summary: The summary of the sync job stream. - :vartype summary: str - :ivar time: The time of the sync job stream. - :vartype time: ~datetime.datetime - :ivar stream_type: The type of the sync job stream. Known values are: "Error" and "Output". - :vartype stream_type: str or ~azure.mgmt.automation.models.StreamType - """ - - _validation = { - "id": {"readonly": True}, - "time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "source_control_sync_job_stream_id": {"key": "properties.sourceControlSyncJobStreamId", "type": "str"}, - "summary": {"key": "properties.summary", "type": "str"}, - "time": {"key": "properties.time", "type": "iso-8601"}, - "stream_type": {"key": "properties.streamType", "type": "str"}, - } - - def __init__( - self, - *, - source_control_sync_job_stream_id: Optional[str] = None, - summary: Optional[str] = None, - stream_type: Optional[Union[str, "_models.StreamType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_control_sync_job_stream_id: The sync job stream id. - :paramtype source_control_sync_job_stream_id: str - :keyword summary: The summary of the sync job stream. - :paramtype summary: str - :keyword stream_type: The type of the sync job stream. Known values are: "Error" and "Output". - :paramtype stream_type: str or ~azure.mgmt.automation.models.StreamType - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.source_control_sync_job_stream_id = source_control_sync_job_stream_id - self.summary = summary - self.time: Optional[datetime.datetime] = None - self.stream_type = stream_type - - -class SourceControlSyncJobStreamById(_serialization.Model): - """Definition of the source control sync job stream by id. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource id. - :vartype id: str - :ivar source_control_sync_job_stream_id: The sync job stream id. - :vartype source_control_sync_job_stream_id: str - :ivar summary: The summary of the sync job stream. - :vartype summary: str - :ivar time: The time of the sync job stream. - :vartype time: ~datetime.datetime - :ivar stream_type: The type of the sync job stream. Known values are: "Error" and "Output". - :vartype stream_type: str or ~azure.mgmt.automation.models.StreamType - :ivar stream_text: The text of the sync job stream. - :vartype stream_text: str - :ivar value: The values of the job stream. - :vartype value: dict[str, JSON] - """ - - _validation = { - "id": {"readonly": True}, - "time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "source_control_sync_job_stream_id": {"key": "properties.sourceControlSyncJobStreamId", "type": "str"}, - "summary": {"key": "properties.summary", "type": "str"}, - "time": {"key": "properties.time", "type": "iso-8601"}, - "stream_type": {"key": "properties.streamType", "type": "str"}, - "stream_text": {"key": "properties.streamText", "type": "str"}, - "value": {"key": "properties.value", "type": "{object}"}, - } - - def __init__( - self, - *, - source_control_sync_job_stream_id: Optional[str] = None, - summary: Optional[str] = None, - stream_type: Optional[Union[str, "_models.StreamType"]] = None, - stream_text: Optional[str] = None, - value: Optional[dict[str, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_control_sync_job_stream_id: The sync job stream id. - :paramtype source_control_sync_job_stream_id: str - :keyword summary: The summary of the sync job stream. - :paramtype summary: str - :keyword stream_type: The type of the sync job stream. Known values are: "Error" and "Output". - :paramtype stream_type: str or ~azure.mgmt.automation.models.StreamType - :keyword stream_text: The text of the sync job stream. - :paramtype stream_text: str - :keyword value: The values of the job stream. - :paramtype value: dict[str, JSON] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.source_control_sync_job_stream_id = source_control_sync_job_stream_id - self.summary = summary - self.time: Optional[datetime.datetime] = None - self.stream_type = stream_type - self.stream_text = stream_text - self.value = value - - -class SourceControlSyncJobStreamsListBySyncJob(_serialization.Model): - """The response model for the list source control sync job streams operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of source control sync job streams. - :vartype value: list[~azure.mgmt.automation.models.SourceControlSyncJobStream] - :ivar next_link: The next link. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SourceControlSyncJobStream]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - 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: Optional[str] = None - - -class SourceControlUpdateParameters(_serialization.Model): - """The parameters supplied to the update source control operation. - - :ivar branch: The repo branch of the source control. - :vartype branch: str - :ivar folder_path: The folder path of the source control. Path must be relative. - :vartype folder_path: str - :ivar auto_sync: The auto sync of the source control. Default is false. - :vartype auto_sync: bool - :ivar publish_runbook: The auto publish of the source control. Default is true. - :vartype publish_runbook: bool - :ivar security_token: The authorization token for the repo of the source control. - :vartype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties - :ivar description: The user description of the source control. - :vartype description: str - """ - - _attribute_map = { - "branch": {"key": "properties.branch", "type": "str"}, - "folder_path": {"key": "properties.folderPath", "type": "str"}, - "auto_sync": {"key": "properties.autoSync", "type": "bool"}, - "publish_runbook": {"key": "properties.publishRunbook", "type": "bool"}, - "security_token": {"key": "properties.securityToken", "type": "SourceControlSecurityTokenProperties"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, - *, - branch: Optional[str] = None, - folder_path: Optional[str] = None, - auto_sync: Optional[bool] = None, - publish_runbook: Optional[bool] = None, - security_token: Optional["_models.SourceControlSecurityTokenProperties"] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword branch: The repo branch of the source control. - :paramtype branch: str - :keyword folder_path: The folder path of the source control. Path must be relative. - :paramtype folder_path: str - :keyword auto_sync: The auto sync of the source control. Default is false. - :paramtype auto_sync: bool - :keyword publish_runbook: The auto publish of the source control. Default is true. - :paramtype publish_runbook: bool - :keyword security_token: The authorization token for the repo of the source control. - :paramtype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties - :keyword description: The user description of the source control. - :paramtype description: str - """ - super().__init__(**kwargs) - self.branch = branch - self.folder_path = folder_path - self.auto_sync = auto_sync - self.publish_runbook = publish_runbook - self.security_token = security_token - self.description = description - - -class Statistics(_serialization.Model): - """Definition of the statistic. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar counter_property: Gets the property value of the statistic. - :vartype counter_property: str - :ivar counter_value: Gets the value of the statistic. - :vartype counter_value: int - :ivar start_time: Gets the startTime of the statistic. - :vartype start_time: ~datetime.datetime - :ivar end_time: Gets the endTime of the statistic. - :vartype end_time: ~datetime.datetime - :ivar id: Gets the id. - :vartype id: str - """ - - _validation = { - "counter_property": {"readonly": True}, - "counter_value": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - "id": {"readonly": True}, - } - - _attribute_map = { - "counter_property": {"key": "counterProperty", "type": "str"}, - "counter_value": {"key": "counterValue", "type": "int"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - 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): - """The response model for the list statistics operation. - - :ivar value: Gets or sets a list of statistics. - :vartype value: list[~azure.mgmt.automation.models.Statistics] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Statistics]"}, - } - - 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] - """ - super().__init__(**kwargs) - self.value = value - - -class TagSettingsProperties(_serialization.Model): - """Tag filter information for the VM. - - :ivar tags: Dictionary of tags with its list of values. - :vartype tags: dict[str, list[str]] - :ivar filter_operator: Filter VMs by Any or All specified tags. Known values are: "All" and - "Any". - :vartype filter_operator: str or ~azure.mgmt.automation.models.TagOperators - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{[str]}"}, - "filter_operator": {"key": "filterOperator", "type": "str"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, list[str]]] = None, - filter_operator: Optional[Union[str, "_models.TagOperators"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Dictionary of tags with its list of values. - :paramtype tags: dict[str, list[str]] - :keyword filter_operator: Filter VMs by Any or All specified tags. Known values are: "All" and - "Any". - :paramtype filter_operator: str or ~azure.mgmt.automation.models.TagOperators - """ - super().__init__(**kwargs) - self.tags = tags - self.filter_operator = filter_operator - - -class TargetProperties(_serialization.Model): - """Group specific to the update configuration. - - :ivar azure_queries: List of Azure queries in the software update configuration. - :vartype azure_queries: list[~azure.mgmt.automation.models.AzureQueryProperties] - :ivar non_azure_queries: List of non Azure queries in the software update configuration. - :vartype non_azure_queries: list[~azure.mgmt.automation.models.NonAzureQueryProperties] - """ - - _attribute_map = { - "azure_queries": {"key": "azureQueries", "type": "[AzureQueryProperties]"}, - "non_azure_queries": {"key": "nonAzureQueries", "type": "[NonAzureQueryProperties]"}, - } - - def __init__( - self, - *, - azure_queries: Optional[list["_models.AzureQueryProperties"]] = None, - non_azure_queries: Optional[list["_models.NonAzureQueryProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword azure_queries: List of Azure queries in the software update configuration. - :paramtype azure_queries: list[~azure.mgmt.automation.models.AzureQueryProperties] - :keyword non_azure_queries: List of non Azure queries in the software update configuration. - :paramtype non_azure_queries: list[~azure.mgmt.automation.models.NonAzureQueryProperties] - """ - super().__init__(**kwargs) - self.azure_queries = azure_queries - self.non_azure_queries = non_azure_queries - - -class TaskProperties(_serialization.Model): - """Task properties of the software update configuration. - - :ivar parameters: Gets or sets the parameters of the task. - :vartype parameters: dict[str, str] - :ivar source: Gets or sets the name of the runbook. - :vartype source: str - """ - - _attribute_map = { - "parameters": {"key": "parameters", "type": "{str}"}, - "source": {"key": "source", "type": "str"}, - } - - def __init__( - self, *, parameters: Optional[dict[str, str]] = None, source: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword parameters: Gets or sets the parameters of the task. - :paramtype parameters: dict[str, str] - :keyword source: Gets or sets the name of the runbook. - :paramtype source: str - """ - super().__init__(**kwargs) - self.parameters = parameters - self.source = source - - -class TestJob(_serialization.Model): - """Definition of the test job. - - :ivar creation_time: Gets or sets the creation time of the test job. - :vartype creation_time: ~datetime.datetime - :ivar status: Gets or sets the status of the test job. - :vartype status: str - :ivar status_details: Gets or sets the status details of the test job. - :vartype status_details: str - :ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be - executed. - :vartype run_on: str - :ivar start_time: Gets or sets the start time of the test job. - :vartype start_time: ~datetime.datetime - :ivar end_time: Gets or sets the end time of the test job. - :vartype end_time: ~datetime.datetime - :ivar exception: Gets or sets the exception of the test job. - :vartype exception: str - :ivar last_modified_time: Gets or sets the last modified time of the test job. - :vartype last_modified_time: ~datetime.datetime - :ivar last_status_modified_time: Gets or sets the last status modified time of the test job. - :vartype last_status_modified_time: ~datetime.datetime - :ivar parameters: Gets or sets the parameters of the test job. - :vartype parameters: dict[str, str] - :ivar log_activity_trace: The activity-level tracing options of the runbook. - :vartype log_activity_trace: int - """ - - _attribute_map = { - "creation_time": {"key": "creationTime", "type": "iso-8601"}, - "status": {"key": "status", "type": "str"}, - "status_details": {"key": "statusDetails", "type": "str"}, - "run_on": {"key": "runOn", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "exception": {"key": "exception", "type": "str"}, - "last_modified_time": {"key": "lastModifiedTime", "type": "iso-8601"}, - "last_status_modified_time": {"key": "lastStatusModifiedTime", "type": "iso-8601"}, - "parameters": {"key": "parameters", "type": "{str}"}, - "log_activity_trace": {"key": "logActivityTrace", "type": "int"}, - } - - def __init__( - self, - *, - creation_time: Optional[datetime.datetime] = None, - status: Optional[str] = None, - status_details: Optional[str] = None, - run_on: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - 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, - log_activity_trace: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword creation_time: Gets or sets the creation time of the test job. - :paramtype creation_time: ~datetime.datetime - :keyword status: Gets or sets the status of the test job. - :paramtype status: str - :keyword status_details: Gets or sets the status details of the test job. - :paramtype status_details: str - :keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be - executed. - :paramtype run_on: str - :keyword start_time: Gets or sets the start time of the test job. - :paramtype start_time: ~datetime.datetime - :keyword end_time: Gets or sets the end time of the test job. - :paramtype end_time: ~datetime.datetime - :keyword exception: Gets or sets the exception of the test job. - :paramtype exception: str - :keyword last_modified_time: Gets or sets the last modified time of the test job. - :paramtype last_modified_time: ~datetime.datetime - :keyword last_status_modified_time: Gets or sets the last status modified time of the test job. - :paramtype last_status_modified_time: ~datetime.datetime - :keyword parameters: Gets or sets the parameters of the test job. - :paramtype parameters: dict[str, str] - :keyword log_activity_trace: The activity-level tracing options of the runbook. - :paramtype log_activity_trace: int - """ - super().__init__(**kwargs) - self.creation_time = creation_time - self.status = status - self.status_details = status_details - self.run_on = run_on - self.start_time = start_time - self.end_time = end_time - self.exception = exception - self.last_modified_time = last_modified_time - self.last_status_modified_time = last_status_modified_time - self.parameters = parameters - self.log_activity_trace = log_activity_trace - - -class TestJobCreateParameters(_serialization.Model): - """The parameters supplied to the create test job operation. - - :ivar parameters: Gets or sets the parameters of the test job. - :vartype parameters: dict[str, str] - :ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be - executed. - :vartype run_on: str - """ - - _attribute_map = { - "parameters": {"key": "parameters", "type": "{str}"}, - "run_on": {"key": "runOn", "type": "str"}, - } - - def __init__( - self, *, parameters: Optional[dict[str, str]] = None, run_on: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword parameters: Gets or sets the parameters of the test job. - :paramtype parameters: dict[str, str] - :keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be - executed. - :paramtype run_on: str - """ - super().__init__(**kwargs) - self.parameters = parameters - self.run_on = run_on - - -class TypeField(_serialization.Model): - """Information about a field of a type. - - :ivar name: Gets or sets the name of the field. - :vartype name: str - :ivar type: Gets or sets the type of the field. - :vartype type: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Gets or sets the name of the field. - :paramtype name: str - :keyword type: Gets or sets the type of the field. - :paramtype type: str - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - -class TypeFieldListResult(_serialization.Model): - """The response model for the list fields operation. - - :ivar value: Gets or sets a list of fields. - :vartype value: list[~azure.mgmt.automation.models.TypeField] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[TypeField]"}, - } - - 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] - """ - super().__init__(**kwargs) - self.value = value - - -class UpdateConfiguration(_serialization.Model): - """Update specific properties of the software update configuration. - - All required parameters must be populated in order to send to server. - - :ivar operating_system: operating system of target machines. Required. Known values are: - "Windows" and "Linux". - :vartype operating_system: str or ~azure.mgmt.automation.models.OperatingSystemType - :ivar windows: Windows specific update configuration. - :vartype windows: ~azure.mgmt.automation.models.WindowsProperties - :ivar linux: Linux specific update configuration. - :vartype linux: ~azure.mgmt.automation.models.LinuxProperties - :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 - :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 non_azure_computer_names: List of names of non-azure machines targeted by the software - update configuration. - :vartype non_azure_computer_names: list[str] - :ivar targets: Group targets for the software update configuration. - :vartype targets: ~azure.mgmt.automation.models.TargetProperties - """ - - _validation = { - "operating_system": {"required": True}, - } - - _attribute_map = { - "operating_system": {"key": "operatingSystem", "type": "str"}, - "windows": {"key": "windows", "type": "WindowsProperties"}, - "linux": {"key": "linux", "type": "LinuxProperties"}, - "duration": {"key": "duration", "type": "duration"}, - "azure_virtual_machines": {"key": "azureVirtualMachines", "type": "[str]"}, - "non_azure_computer_names": {"key": "nonAzureComputerNames", "type": "[str]"}, - "targets": {"key": "targets", "type": "TargetProperties"}, - } - - def __init__( - self, - *, - operating_system: Union[str, "_models.OperatingSystemType"], - 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, - targets: Optional["_models.TargetProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword operating_system: operating system of target machines. Required. Known values are: - "Windows" and "Linux". - :paramtype operating_system: str or ~azure.mgmt.automation.models.OperatingSystemType - :keyword windows: Windows specific update configuration. - :paramtype windows: ~azure.mgmt.automation.models.WindowsProperties - :keyword linux: Linux specific update configuration. - :paramtype linux: ~azure.mgmt.automation.models.LinuxProperties - :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 - :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 non_azure_computer_names: List of names of non-azure machines targeted by the software - update configuration. - :paramtype non_azure_computer_names: list[str] - :keyword targets: Group targets for the software update configuration. - :paramtype targets: ~azure.mgmt.automation.models.TargetProperties - """ - super().__init__(**kwargs) - self.operating_system = operating_system - self.windows = windows - self.linux = linux - self.duration = duration - self.azure_virtual_machines = azure_virtual_machines - self.non_azure_computer_names = non_azure_computer_names - self.targets = targets - - -class UpdateConfigurationNavigation(_serialization.Model): - """Software update configuration Run Navigation model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the software update configuration triggered the software update - configuration run. - :vartype name: str - """ - - _validation = { - "name": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - - -class Usage(_serialization.Model): - """Definition of Usage. - - :ivar id: Gets or sets the id of the resource. - :vartype id: str - :ivar name: Gets or sets the usage counter name. - :vartype name: ~azure.mgmt.automation.models.UsageCounterName - :ivar unit: Gets or sets the usage unit name. - :vartype unit: str - :ivar current_value: Gets or sets the current usage value. - :vartype current_value: float - :ivar limit: Gets or sets max limit. -1 for unlimited. - :vartype limit: int - :ivar throttle_status: Gets or sets the throttle status. - :vartype throttle_status: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "UsageCounterName"}, - "unit": {"key": "unit", "type": "str"}, - "current_value": {"key": "currentValue", "type": "float"}, - "limit": {"key": "limit", "type": "int"}, - "throttle_status": {"key": "throttleStatus", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional["_models.UsageCounterName"] = None, - unit: Optional[str] = None, - current_value: Optional[float] = None, - limit: Optional[int] = None, - throttle_status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Gets or sets the id of the resource. - :paramtype id: str - :keyword name: Gets or sets the usage counter name. - :paramtype name: ~azure.mgmt.automation.models.UsageCounterName - :keyword unit: Gets or sets the usage unit name. - :paramtype unit: str - :keyword current_value: Gets or sets the current usage value. - :paramtype current_value: float - :keyword limit: Gets or sets max limit. -1 for unlimited. - :paramtype limit: int - :keyword throttle_status: Gets or sets the throttle status. - :paramtype throttle_status: str - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.unit = unit - self.current_value = current_value - self.limit = limit - self.throttle_status = throttle_status - - -class UsageCounterName(_serialization.Model): - """Definition of usage counter name. - - :ivar value: Gets or sets the usage counter name. - :vartype value: str - :ivar localized_value: Gets or sets the localized usage counter name. - :vartype localized_value: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "localized_value": {"key": "localizedValue", "type": "str"}, - } - - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: Gets or sets the usage counter name. - :paramtype value: str - :keyword localized_value: Gets or sets the localized usage counter name. - :paramtype localized_value: str - """ - super().__init__(**kwargs) - self.value = value - self.localized_value = localized_value - - -class UsageListResult(_serialization.Model): - """The response model for the get usage operation. - - :ivar value: Gets or sets usage. - :vartype value: list[~azure.mgmt.automation.models.Usage] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Usage]"}, - } - - 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] - """ - super().__init__(**kwargs) - self.value = value - - -class Variable(ProxyResource): - """Definition of the variable. - - 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 value: Gets or sets the value of the variable. - :vartype value: str - :ivar is_encrypted: Gets or sets the encrypted flag of the variable. - :vartype is_encrypted: bool - :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 = { - "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"}, - "value": {"key": "properties.value", "type": "str"}, - "is_encrypted": {"key": "properties.isEncrypted", "type": "bool"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[str] = None, - is_encrypted: Optional[bool] = None, - creation_time: Optional[datetime.datetime] = None, - last_modified_time: Optional[datetime.datetime] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets the value of the variable. - :paramtype value: str - :keyword is_encrypted: Gets or sets the encrypted flag of the variable. - :paramtype is_encrypted: bool - :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.value = value - self.is_encrypted = is_encrypted - self.creation_time = creation_time - self.last_modified_time = last_modified_time - self.description = description - - -class VariableCreateOrUpdateParameters(_serialization.Model): - """The parameters supplied to the create or update variable operation. - - All required parameters must be populated in order to send to server. - - :ivar name: Gets or sets the name of the variable. Required. - :vartype name: str - :ivar value: Gets or sets the value of the variable. - :vartype value: str - :ivar description: Gets or sets the description of the variable. - :vartype description: str - :ivar is_encrypted: Gets or sets the encrypted flag of the variable. - :vartype is_encrypted: bool - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "properties.value", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "is_encrypted": {"key": "properties.isEncrypted", "type": "bool"}, - } - - def __init__( - self, - *, - name: str, - value: Optional[str] = None, - description: Optional[str] = None, - is_encrypted: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the variable. Required. - :paramtype name: str - :keyword value: Gets or sets the value of the variable. - :paramtype value: str - :keyword description: Gets or sets the description of the variable. - :paramtype description: str - :keyword is_encrypted: Gets or sets the encrypted flag of the variable. - :paramtype is_encrypted: bool - """ - super().__init__(**kwargs) - self.name = name - self.value = value - self.description = description - self.is_encrypted = is_encrypted - - -class VariableListResult(_serialization.Model): - """The response model for the list variables operation. - - :ivar value: Gets or sets a list of variables. - :vartype value: list[~azure.mgmt.automation.models.Variable] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Variable]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Variable"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of variables. - :paramtype value: list[~azure.mgmt.automation.models.Variable] - :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 VariableUpdateParameters(_serialization.Model): - """The parameters supplied to the update variable operation. - - :ivar name: Gets or sets the name of the variable. - :vartype name: str - :ivar value: Gets or sets the value of the variable. - :vartype value: str - :ivar description: Gets or sets the description of the variable. - :vartype description: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "properties.value", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - value: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the variable. - :paramtype name: str - :keyword value: Gets or sets the value of the variable. - :paramtype value: str - :keyword description: Gets or sets the description of the variable. - :paramtype description: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - self.description = description - - -class Watcher(TrackedResource): - """Definition of the watcher type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The Azure Region where the resource lives. - :vartype location: str - :ivar etag: Gets or sets the etag of the resource. - :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 - :ivar script_name: Gets or sets the name of the script the watcher is attached to, i.e. the - name of an existing runbook. - :vartype script_name: str - :ivar script_parameters: Gets or sets the parameters of the script. - :vartype script_parameters: dict[str, str] - :ivar script_run_on: Gets or sets the name of the hybrid worker group the watcher will run on. - :vartype script_run_on: str - :ivar status: Gets the current status of the watcher. - :vartype status: str - :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 last_modified_by: Details of the user who last modified the watcher. - :vartype last_modified_by: str - :ivar description: Gets or sets the description. - :vartype description: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "status": {"readonly": True}, - "creation_time": {"readonly": True}, - "last_modified_time": {"readonly": True}, - "last_modified_by": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "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}"}, - "script_run_on": {"key": "properties.scriptRunOn", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "last_modified_by": {"key": "properties.lastModifiedBy", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, - *, - 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_run_on: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The Azure Region where the resource lives. - :paramtype location: str - :keyword etag: Gets or sets the etag of the resource. - :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 - :keyword script_name: Gets or sets the name of the script the watcher is attached to, i.e. the - name of an existing runbook. - :paramtype script_name: str - :keyword script_parameters: Gets or sets the parameters of the script. - :paramtype script_parameters: dict[str, str] - :keyword script_run_on: Gets or sets the name of the hybrid worker group the watcher will run - on. - :paramtype script_run_on: str - :keyword description: Gets or sets the description. - :paramtype description: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag = etag - 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: 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 - - -class WatcherListResult(_serialization.Model): - """The response model for the list watcher operation. - - :ivar value: Gets or sets a list of watchers. - :vartype value: list[~azure.mgmt.automation.models.Watcher] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Watcher]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Watcher"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of watchers. - :paramtype value: list[~azure.mgmt.automation.models.Watcher] - :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 WatcherUpdateParameters(_serialization.Model): - """WatcherUpdateParameters. - - :ivar name: Gets or sets the name of the resource. - :vartype name: str - :ivar execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is - invoked. - :vartype execution_frequency_in_seconds: int - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "execution_frequency_in_seconds": {"key": "properties.executionFrequencyInSeconds", "type": "int"}, - } - - def __init__( - self, *, name: Optional[str] = None, execution_frequency_in_seconds: Optional[int] = None, **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the resource. - :paramtype name: str - :keyword execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is - invoked. - :paramtype execution_frequency_in_seconds: int - """ - super().__init__(**kwargs) - self.name = name - self.execution_frequency_in_seconds = execution_frequency_in_seconds - - -class Webhook(ProxyResource): - """Definition of the webhook type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar is_enabled: Gets or sets the value of the enabled flag of the webhook. - :vartype is_enabled: bool - :ivar uri: Gets or sets the webhook uri. - :vartype uri: str - :ivar expiry_time: Gets or sets the expiry time. - :vartype expiry_time: ~datetime.datetime - :ivar last_invoked_time: Gets or sets the last invoked time. - :vartype last_invoked_time: ~datetime.datetime - :ivar parameters: Gets or sets the parameters of the job that is created when the webhook calls - the runbook it is associated with. - :vartype parameters: dict[str, str] - :ivar runbook: Gets or sets the runbook the webhook is associated with. - :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty - :ivar run_on: Gets or sets the name of the hybrid worker group the webhook job will run on. - :vartype run_on: str - :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 last_modified_by: Details of the user who last modified the Webhook. - :vartype last_modified_by: str - :ivar description: Gets or sets the description. - :vartype description: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, - "uri": {"key": "properties.uri", "type": "str"}, - "expiry_time": {"key": "properties.expiryTime", "type": "iso-8601"}, - "last_invoked_time": {"key": "properties.lastInvokedTime", "type": "iso-8601"}, - "parameters": {"key": "properties.parameters", "type": "{str}"}, - "runbook": {"key": "properties.runbook", "type": "RunbookAssociationProperty"}, - "run_on": {"key": "properties.runOn", "type": "str"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "last_modified_by": {"key": "properties.lastModifiedBy", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, - *, - is_enabled: bool = False, - uri: Optional[str] = None, - expiry_time: Optional[datetime.datetime] = None, - last_invoked_time: Optional[datetime.datetime] = None, - parameters: Optional[dict[str, str]] = None, - runbook: Optional["_models.RunbookAssociationProperty"] = None, - run_on: Optional[str] = None, - creation_time: Optional[datetime.datetime] = None, - last_modified_time: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword is_enabled: Gets or sets the value of the enabled flag of the webhook. - :paramtype is_enabled: bool - :keyword uri: Gets or sets the webhook uri. - :paramtype uri: str - :keyword expiry_time: Gets or sets the expiry time. - :paramtype expiry_time: ~datetime.datetime - :keyword last_invoked_time: Gets or sets the last invoked time. - :paramtype last_invoked_time: ~datetime.datetime - :keyword parameters: Gets or sets the parameters of the job that is created when the webhook - calls the runbook it is associated with. - :paramtype parameters: dict[str, str] - :keyword runbook: Gets or sets the runbook the webhook is associated with. - :paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty - :keyword run_on: Gets or sets the name of the hybrid worker group the webhook job will run on. - :paramtype run_on: str - :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 last_modified_by: Details of the user who last modified the Webhook. - :paramtype last_modified_by: str - :keyword description: Gets or sets the description. - :paramtype description: str - """ - super().__init__(**kwargs) - self.is_enabled = is_enabled - self.uri = uri - self.expiry_time = expiry_time - self.last_invoked_time = last_invoked_time - self.parameters = parameters - self.runbook = runbook - self.run_on = run_on - self.creation_time = creation_time - self.last_modified_time = last_modified_time - self.last_modified_by = last_modified_by - self.description = description - - -class WebhookCreateOrUpdateParameters(_serialization.Model): - """The parameters supplied to the create or update webhook operation. - - All required parameters must be populated in order to send to server. - - :ivar name: Gets or sets the name of the webhook. Required. - :vartype name: str - :ivar is_enabled: Gets or sets the value of the enabled flag of webhook. - :vartype is_enabled: bool - :ivar uri: Gets or sets the uri. - :vartype uri: str - :ivar expiry_time: Gets or sets the expiry time. - :vartype expiry_time: ~datetime.datetime - :ivar parameters: Gets or sets the parameters of the job. - :vartype parameters: dict[str, str] - :ivar runbook: Gets or sets the runbook. - :vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty - :ivar run_on: Gets or sets the name of the hybrid worker group the webhook job will run on. - :vartype run_on: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, - "uri": {"key": "properties.uri", "type": "str"}, - "expiry_time": {"key": "properties.expiryTime", "type": "iso-8601"}, - "parameters": {"key": "properties.parameters", "type": "{str}"}, - "runbook": {"key": "properties.runbook", "type": "RunbookAssociationProperty"}, - "run_on": {"key": "properties.runOn", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - is_enabled: Optional[bool] = None, - uri: Optional[str] = None, - expiry_time: Optional[datetime.datetime] = None, - parameters: Optional[dict[str, str]] = None, - runbook: Optional["_models.RunbookAssociationProperty"] = None, - run_on: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the webhook. Required. - :paramtype name: str - :keyword is_enabled: Gets or sets the value of the enabled flag of webhook. - :paramtype is_enabled: bool - :keyword uri: Gets or sets the uri. - :paramtype uri: str - :keyword expiry_time: Gets or sets the expiry time. - :paramtype expiry_time: ~datetime.datetime - :keyword parameters: Gets or sets the parameters of the job. - :paramtype parameters: dict[str, str] - :keyword runbook: Gets or sets the runbook. - :paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty - :keyword run_on: Gets or sets the name of the hybrid worker group the webhook job will run on. - :paramtype run_on: str - """ - super().__init__(**kwargs) - self.name = name - self.is_enabled = is_enabled - self.uri = uri - self.expiry_time = expiry_time - self.parameters = parameters - self.runbook = runbook - self.run_on = run_on - - -class WebhookListResult(_serialization.Model): - """The response model for the list webhook operation. - - :ivar value: Gets or sets a list of webhooks. - :vartype value: list[~azure.mgmt.automation.models.Webhook] - :ivar next_link: Gets or sets the next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Webhook]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Webhook"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Gets or sets a list of webhooks. - :paramtype value: list[~azure.mgmt.automation.models.Webhook] - :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 WebhookUpdateParameters(_serialization.Model): - """The parameters supplied to the update webhook operation. - - :ivar name: Gets or sets the name of the webhook. - :vartype name: str - :ivar is_enabled: Gets or sets the value of the enabled flag of webhook. - :vartype is_enabled: bool - :ivar run_on: Gets or sets the name of the hybrid worker group the webhook job will run on. - :vartype run_on: str - :ivar parameters: Gets or sets the parameters of the job. - :vartype parameters: dict[str, str] - :ivar description: Gets or sets the description of the webhook. - :vartype description: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, - "run_on": {"key": "properties.runOn", "type": "str"}, - "parameters": {"key": "properties.parameters", "type": "{str}"}, - "description": {"key": "properties.description", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_enabled: Optional[bool] = None, - run_on: Optional[str] = None, - parameters: Optional[dict[str, str]] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Gets or sets the name of the webhook. - :paramtype name: str - :keyword is_enabled: Gets or sets the value of the enabled flag of webhook. - :paramtype is_enabled: bool - :keyword run_on: Gets or sets the name of the hybrid worker group the webhook job will run on. - :paramtype run_on: str - :keyword parameters: Gets or sets the parameters of the job. - :paramtype parameters: dict[str, str] - :keyword description: Gets or sets the description of the webhook. - :paramtype description: str - """ - super().__init__(**kwargs) - self.name = name - self.is_enabled = is_enabled - self.run_on = run_on - self.parameters = parameters - self.description = description - - -class WindowsProperties(_serialization.Model): - """Windows specific update configuration. - - :ivar included_update_classifications: Update classification included in the software update - configuration. A comma separated string with required values. Known values are: "Unclassified", - "Critical", "Security", "UpdateRollup", "FeaturePack", "ServicePack", "Definition", "Tools", - and "Updates". - :vartype included_update_classifications: str or - ~azure.mgmt.automation.models.WindowsUpdateClasses - :ivar excluded_kb_numbers: KB numbers excluded from the software update configuration. - :vartype excluded_kb_numbers: list[str] - :ivar included_kb_numbers: KB numbers included from the software update configuration. - :vartype included_kb_numbers: list[str] - :ivar reboot_setting: Reboot setting for the software update configuration. - :vartype reboot_setting: str - """ - - _attribute_map = { - "included_update_classifications": {"key": "includedUpdateClassifications", "type": "str"}, - "excluded_kb_numbers": {"key": "excludedKbNumbers", "type": "[str]"}, - "included_kb_numbers": {"key": "includedKbNumbers", "type": "[str]"}, - "reboot_setting": {"key": "rebootSetting", "type": "str"}, - } - - 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, - reboot_setting: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword included_update_classifications: Update classification included in the software update - configuration. A comma separated string with required values. Known values are: "Unclassified", - "Critical", "Security", "UpdateRollup", "FeaturePack", "ServicePack", "Definition", "Tools", - and "Updates". - :paramtype included_update_classifications: str or - ~azure.mgmt.automation.models.WindowsUpdateClasses - :keyword excluded_kb_numbers: KB numbers excluded from the software update configuration. - :paramtype excluded_kb_numbers: list[str] - :keyword included_kb_numbers: KB numbers included from the software update configuration. - :paramtype included_kb_numbers: list[str] - :keyword reboot_setting: Reboot setting for the software update configuration. - :paramtype reboot_setting: str - """ - super().__init__(**kwargs) - self.included_update_classifications = included_update_classifications - self.excluded_kb_numbers = excluded_kb_numbers - self.included_kb_numbers = included_kb_numbers - self.reboot_setting = reboot_setting 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 49900f6ab120..ea765788358a 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 @@ -1,15 +1,14 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): 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 e63de9f02ba2..e02702657b27 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,94 +12,105 @@ 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 ._operations import SoftwareUpdateConfigurationsOperations # type: ignore +from ._operations import HybridRunbookWorkersOperations # type: ignore +from ._operations import Python2PackageOperations # type: ignore +from ._operations import Python3PackageOperations # type: ignore +from ._operations import RuntimeEnvironmentsOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import AutomationAccountOperations # type: ignore +from ._operations import NodeCountInformationOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import AgentRegistrationInformationOperations # type: ignore +from ._operations import StatisticsOperations # type: ignore +from ._operations import UsagesOperations # type: ignore +from ._operations import KeysOperations # type: ignore +from ._operations import JobOperations # type: ignore +from ._operations import LinkedWorkspaceOperations # type: ignore +from ._operations import ObjectDataTypesOperations # type: ignore +from ._operations import SoftwareUpdateConfigurationMachineRunsOperations # type: ignore +from ._operations import SoftwareUpdateConfigurationRunsOperations # type: ignore +from ._operations import WebhookOperations # type: ignore +from ._operations import DscNodeOperations # type: ignore +from ._operations import NodeReportsOperations # type: ignore +from ._operations import CertificateOperations # type: ignore +from ._operations import ConnectionOperations # type: ignore +from ._operations import ConnectionTypeOperations # type: ignore +from ._operations import CredentialOperations # type: ignore +from ._operations import DscConfigurationOperations # type: ignore +from ._operations import DscNodeConfigurationOperations # type: ignore +from ._operations import HybridRunbookWorkerGroupOperations # type: ignore +from ._operations import JobStreamOperations # type: ignore +from ._operations import JobScheduleOperations # type: ignore +from ._operations import ModuleOperations # type: ignore +from ._operations import ActivityOperations # type: ignore +from ._operations import FieldsOperations # type: ignore +from ._operations import PackageOperations # type: ignore +from ._operations import RunbookOperations # type: ignore +from ._operations import RunbookDraftOperations # type: ignore +from ._operations import TestJobStreamsOperations # type: ignore +from ._operations import TestJobOperations # type: ignore +from ._operations import ScheduleOperations # type: ignore +from ._operations import SourceControlOperations # type: ignore +from ._operations import SourceControlSyncJobOperations # type: ignore +from ._operations import SourceControlSyncJobStreamsOperations # type: ignore +from ._operations import VariableOperations # type: ignore +from ._operations import WatcherOperations # type: ignore +from ._operations import DeletedAutomationAccountsOperations # type: ignore +from ._operations import _AutomationClientOperationsMixin # type: ignore # pylint: disable=unused-import from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AutomationAccountOperations", "Operations", + "SoftwareUpdateConfigurationsOperations", + "HybridRunbookWorkersOperations", + "Python2PackageOperations", + "Python3PackageOperations", + "RuntimeEnvironmentsOperations", + "PrivateEndpointConnectionsOperations", + "AutomationAccountOperations", + "NodeCountInformationOperations", + "PrivateLinkResourcesOperations", + "AgentRegistrationInformationOperations", "StatisticsOperations", "UsagesOperations", "KeysOperations", + "JobOperations", + "LinkedWorkspaceOperations", + "ObjectDataTypesOperations", + "SoftwareUpdateConfigurationMachineRunsOperations", + "SoftwareUpdateConfigurationRunsOperations", + "WebhookOperations", + "DscNodeOperations", + "NodeReportsOperations", "CertificateOperations", "ConnectionOperations", "ConnectionTypeOperations", "CredentialOperations", "DscConfigurationOperations", + "DscNodeConfigurationOperations", "HybridRunbookWorkerGroupOperations", + "JobStreamOperations", "JobScheduleOperations", - "LinkedWorkspaceOperations", - "ActivityOperations", "ModuleOperations", - "ObjectDataTypesOperations", + "ActivityOperations", "FieldsOperations", + "PackageOperations", + "RunbookOperations", + "RunbookDraftOperations", + "TestJobStreamsOperations", + "TestJobOperations", "ScheduleOperations", - "VariableOperations", - "WebhookOperations", - "WatcherOperations", - "SoftwareUpdateConfigurationsOperations", - "SoftwareUpdateConfigurationRunsOperations", - "SoftwareUpdateConfigurationMachineRunsOperations", "SourceControlOperations", "SourceControlSyncJobOperations", "SourceControlSyncJobStreamsOperations", - "JobOperations", - "JobStreamOperations", - "AgentRegistrationInformationOperations", - "DscNodeOperations", - "NodeReportsOperations", - "DscCompilationJobOperations", - "DscCompilationJobStreamOperations", - "DscNodeConfigurationOperations", - "NodeCountInformationOperations", - "RunbookDraftOperations", - "RunbookOperations", - "TestJobStreamsOperations", - "TestJobOperations", - "Python2PackageOperations", + "VariableOperations", + "WatcherOperations", + "DeletedAutomationAccountsOperations", ] __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 deleted file mode 100644 index a6a6cbcb15bc..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_activity_operations.py +++ /dev/null @@ -1,286 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - automation_account_name: str, - module_name: str, - activity_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}", - ) - 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"), - "moduleName": _SERIALIZER.url("module_name", module_name, "str"), - "activityName": _SERIALIZER.url("activity_name", activity_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_module_request( - resource_group_name: str, automation_account_name: str, module_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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", - ) - 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"), - "moduleName": _SERIALIZER.url("module_name", module_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_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 ActivityOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`activity` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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, - module_name: str, - activity_name: str, - **kwargs: Any - ) -> _models.Activity: - """Retrieve the activity in the module identified by module name and activity name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/activityoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param activity_name: The name of activity. Required. - :type activity_name: str - :return: Activity or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Activity - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - activity_name=activity_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("Activity", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_module( - self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any - ) -> ItemPaged["_models.Activity"]: - """Retrieve a list of activities in the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/activityoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :return: An iterator like instance of either Activity or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Activity] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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_module_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("ActivityListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_agent_registration_information_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_agent_registration_information_operations.py deleted file mode 100644 index 64b0e4405cbb..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_agent_registration_information_operations.py +++ /dev/null @@ -1,328 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_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", "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", - ) - 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_regenerate_key_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", "2018-01-15")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/agentRegistrationInformation/regenerateKey", - ) - 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 - if content_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 AgentRegistrationInformationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`agent_registration_information` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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: - """Retrieve the automation agent registration information. - - .. seealso:: - - http://aka.ms/azureautomationsdk/agentregistrationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: AgentRegistration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AgentRegistration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) - - _request = build_get_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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_key( - self, - resource_group_name: str, - automation_account_name: str, - parameters: _models.AgentRegistrationRegenerateKeyParameter, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AgentRegistration: - """Regenerate a primary or secondary agent registration key. - - .. seealso:: - - http://aka.ms/azureautomationsdk/agentregistrationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: The name of the agent registration key to be regenerated. Required. - :type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AgentRegistration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AgentRegistration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_key( - self, - resource_group_name: str, - automation_account_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AgentRegistration: - """Regenerate a primary or secondary agent registration key. - - .. seealso:: - - http://aka.ms/azureautomationsdk/agentregistrationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: The name of the agent registration key to be regenerated. 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: AgentRegistration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AgentRegistration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_key( - self, - resource_group_name: str, - automation_account_name: str, - parameters: Union[_models.AgentRegistrationRegenerateKeyParameter, IO[bytes]], - **kwargs: Any - ) -> _models.AgentRegistration: - """Regenerate a primary or secondary agent registration key. - - .. seealso:: - - http://aka.ms/azureautomationsdk/agentregistrationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: The name of the agent registration key to be regenerated. Is either a - AgentRegistrationRegenerateKeyParameter type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter or - IO[bytes] - :return: AgentRegistration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AgentRegistration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AgentRegistrationRegenerateKeyParameter") - - _request = build_regenerate_key_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("AgentRegistration", 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/_automation_account_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_account_operations.py deleted file mode 100644 index 63583141360a..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_account_operations.py +++ /dev/null @@ -1,795 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_update_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", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}", - ) - 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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_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", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}", - ) - 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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_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", "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}", - ) - 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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_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", "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}", - ) - 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) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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", "2015-10-31")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts" - ) - 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 AutomationAccountOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`automation_account` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - parameters: _models.AutomationAccountUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutomationAccount: - """Update an automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: Parameters supplied to the update automation account. Required. - :type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutomationAccount: - """Update an automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: Parameters supplied to the update automation account. 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: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - automation_account_name: str, - parameters: Union[_models.AutomationAccountUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.AutomationAccount: - """Update an automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: Parameters supplied to the update automation account. Is either a - AutomationAccountUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters or IO[bytes] - :return: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AutomationAccountUpdateParameters") - - _request = build_update_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("AutomationAccount", 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, - parameters: _models.AutomationAccountCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutomationAccount: - """Create or update automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: Parameters supplied to the create or update automation account. Required. - :type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutomationAccount: - """Create or update automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: Parameters supplied to the create or update automation account. 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: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - parameters: Union[_models.AutomationAccountCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.AutomationAccount: - """Create or update automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param parameters: Parameters supplied to the create or update automation account. Is either a - AutomationAccountCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters or - IO[bytes] - :return: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AutomationAccountCreateOrUpdateParameters") - - _request = build_create_or_update_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, 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("AutomationAccount", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> None: - """Delete an automation account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - 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) - - _stream = False - pipeline_response: PipelineResponse = 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, **kwargs: Any) -> _models.AutomationAccount: - """Get information about an Automation Account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: AutomationAccount or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.AutomationAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - 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:: - - http://aka.ms/azureautomationsdk/automationaccountoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :return: An iterator like instance of either AutomationAccount or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.AutomationAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("AutomationAccountListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.AutomationAccount"]: - """Lists the Automation Accounts within an Azure subscription. - - Retrieve a list of accounts within a given subscription. - - :return: An iterator like instance of either AutomationAccount or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.AutomationAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("AutomationAccountListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_certificate_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_certificate_operations.py deleted file mode 100644 index c34b0cd65cd9..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_certificate_operations.py +++ /dev/null @@ -1,745 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, automation_account_name: str, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # 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, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_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, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/certificates/{certificateName}", - ) - 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"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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, certificate_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/certificates/{certificateName}", - ) - 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"), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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", "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", - ) - 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 CertificateOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`certificate` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - self, resource_group_name: str, automation_account_name: str, certificate_name: str, **kwargs: Any - ) -> None: - """Delete the certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The name of certificate. Required. - :type certificate_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - certificate_name=certificate_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, certificate_name: str, **kwargs: Any - ) -> _models.Certificate: - """Retrieve the certificate identified by certificate name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The name of certificate. Required. - :type certificate_name: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - certificate_name=certificate_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("Certificate", 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, - certificate_name: str, - parameters: _models.CertificateCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Certificate: - """Create a certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The parameters supplied to the create or update certificate operation. - Required. - :type certificate_name: str - :param parameters: The parameters supplied to the create or update certificate operation. - Required. - :type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - certificate_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Certificate: - """Create a certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The parameters supplied to the create or update certificate operation. - Required. - :type certificate_name: str - :param parameters: The parameters supplied to the create or update certificate operation. - 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: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - certificate_name: str, - parameters: Union[_models.CertificateCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Certificate: - """Create a certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The parameters supplied to the create or update certificate operation. - Required. - :type certificate_name: str - :param parameters: The parameters supplied to the create or update certificate operation. Is - either a CertificateCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters or - IO[bytes] - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - certificate_name=certificate_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("Certificate", 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, - certificate_name: str, - parameters: _models.CertificateUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Certificate: - """Update a certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The parameters supplied to the update certificate operation. Required. - :type certificate_name: str - :param parameters: The parameters supplied to the update certificate operation. Required. - :type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - certificate_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Certificate: - """Update a certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The parameters supplied to the update certificate operation. Required. - :type certificate_name: str - :param parameters: The parameters supplied to the update certificate operation. 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: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - automation_account_name: str, - certificate_name: str, - parameters: Union[_models.CertificateUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Certificate: - """Update a certificate. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param certificate_name: The parameters supplied to the update certificate operation. Required. - :type certificate_name: str - :param parameters: The parameters supplied to the update certificate operation. Is either a - CertificateUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters or IO[bytes] - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Certificate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CertificateUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - certificate_name=certificate_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("Certificate", 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 - ) -> ItemPaged["_models.Certificate"]: - """Retrieve a list of certificates. - - .. seealso:: - - http://aka.ms/azureautomationsdk/certificateoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Certificate or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Certificate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("CertificateListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_connection_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_operations.py deleted file mode 100644 index ccd32fe507d2..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_operations.py +++ /dev/null @@ -1,750 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, automation_account_name: str, connection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, automation_account_name: str, connection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, automation_account_name: str, connection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/connections/{connectionName}", - ) - 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"), - "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, automation_account_name: str, connection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/connections/{connectionName}", - ) - 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"), - "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="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", "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", - ) - 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 ConnectionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`connection` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, connection_name: str, **kwargs: Any - ) -> Optional[_models.Connection]: - """Delete the connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The name of connection. Required. - :type connection_name: str - :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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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, - automation_account_name=automation_account_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Connection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, connection_name: str, **kwargs: Any - ) -> _models.Connection: - """Retrieve the connection identified by connection name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The name of connection. Required. - :type connection_name: str - :return: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Connection", 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, - connection_name: str, - parameters: _models.ConnectionCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Connection: - """Create or update a connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The parameters supplied to the create or update connection operation. - Required. - :type connection_name: str - :param parameters: The parameters supplied to the create or update connection operation. - Required. - :type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - connection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Connection: - """Create or update a connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The parameters supplied to the create or update connection operation. - Required. - :type connection_name: str - :param parameters: The parameters supplied to the create or update connection operation. - 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: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - connection_name: str, - parameters: Union[_models.ConnectionCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Connection: - """Create or update a connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The parameters supplied to the create or update connection operation. - Required. - :type connection_name: str - :param parameters: The parameters supplied to the create or update connection operation. Is - either a ConnectionCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters or IO[bytes] - :return: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ConnectionCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_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("Connection", 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, - connection_name: str, - parameters: _models.ConnectionUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Connection: - """Update a connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The parameters supplied to the update a connection operation. Required. - :type connection_name: str - :param parameters: The parameters supplied to the update a connection operation. Required. - :type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - connection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Connection: - """Update a connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The parameters supplied to the update a connection operation. Required. - :type connection_name: str - :param parameters: The parameters supplied to the update a connection operation. 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: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - automation_account_name: str, - connection_name: str, - parameters: Union[_models.ConnectionUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Connection: - """Update a connection. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_name: The parameters supplied to the update a connection operation. Required. - :type connection_name: str - :param parameters: The parameters supplied to the update a connection operation. Is either a - ConnectionUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters or IO[bytes] - :return: Connection or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Connection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ConnectionUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Connection", pipeline_response.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 - ) -> ItemPaged["_models.Connection"]: - """Retrieve a list of connections. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectionoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Connection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Connection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - cls: ClsType[_models.ConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("ConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_connection_type_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_type_operations.py deleted file mode 100644 index 4f4911557f67..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_type_operations.py +++ /dev/null @@ -1,570 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, - automation_account_name: str, - connection_type_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}", - ) - 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"), - "connectionTypeName": _SERIALIZER.url("connection_type_name", connection_type_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # 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, - connection_type_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}", - ) - 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"), - "connectionTypeName": _SERIALIZER.url("connection_type_name", connection_type_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_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, - connection_type_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", - ) - 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"), - "connectionTypeName": _SERIALIZER.url("connection_type_name", connection_type_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_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", "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", - ) - 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 ConnectionTypeOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`connection_type` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - self, resource_group_name: str, automation_account_name: str, connection_type_name: str, **kwargs: Any - ) -> None: - """Delete the connection type. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectiontypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_type_name: The name of connection type. Required. - :type connection_type_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - connection_type_name=connection_type_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, connection_type_name: str, **kwargs: Any - ) -> _models.ConnectionType: - """Retrieve the connection type identified by connection type name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectiontypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_type_name: The name of connection type. Required. - :type connection_type_name: str - :return: ConnectionType or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.ConnectionType - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - connection_type_name=connection_type_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("ConnectionType", 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, - connection_type_name: str, - parameters: _models.ConnectionTypeCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionType: - """Create a connection type. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectiontypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_type_name: The parameters supplied to the create or update connection type - operation. Required. - :type connection_type_name: str - :param parameters: The parameters supplied to the create or update connection type operation. - Required. - :type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ConnectionType or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.ConnectionType - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - connection_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionType: - """Create a connection type. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectiontypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_type_name: The parameters supplied to the create or update connection type - operation. Required. - :type connection_type_name: str - :param parameters: The parameters supplied to the create or update connection type operation. - 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: ConnectionType or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.ConnectionType - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - connection_type_name: str, - parameters: Union[_models.ConnectionTypeCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ConnectionType: - """Create a connection type. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectiontypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param connection_type_name: The parameters supplied to the create or update connection type - operation. Required. - :type connection_type_name: str - :param parameters: The parameters supplied to the create or update connection type operation. - Is either a ConnectionTypeCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters or - IO[bytes] - :return: ConnectionType or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.ConnectionType - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ConnectionTypeCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - connection_type_name=connection_type_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 [201, 409]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - 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 - ) -> ItemPaged["_models.ConnectionType"]: - """Retrieve a list of connection types. - - .. seealso:: - - http://aka.ms/azureautomationsdk/connectiontypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either ConnectionType or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.ConnectionType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("ConnectionTypeListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_credential_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_credential_operations.py deleted file mode 100644 index 4772df2f9f50..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_credential_operations.py +++ /dev/null @@ -1,740 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, automation_account_name: str, credential_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}", - ) - 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"), - "credentialName": _SERIALIZER.url("credential_name", credential_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # 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, credential_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}", - ) - 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"), - "credentialName": _SERIALIZER.url("credential_name", credential_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_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, credential_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", - ) - 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"), - "credentialName": _SERIALIZER.url("credential_name", credential_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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, credential_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", - ) - 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"), - "credentialName": _SERIALIZER.url("credential_name", credential_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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", "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", - ) - 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 CredentialOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`credential` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - self, resource_group_name: str, automation_account_name: str, credential_name: str, **kwargs: Any - ) -> None: - """Delete the credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The name of credential. Required. - :type credential_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - credential_name=credential_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, credential_name: str, **kwargs: Any - ) -> _models.Credential: - """Retrieve the credential identified by credential name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The name of credential. Required. - :type credential_name: str - :return: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - credential_name=credential_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("Credential", 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, - credential_name: str, - parameters: _models.CredentialCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Credential: - """Create a credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The parameters supplied to the create or update credential operation. - Required. - :type credential_name: str - :param parameters: The parameters supplied to the create or update credential operation. - Required. - :type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - credential_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Credential: - """Create a credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The parameters supplied to the create or update credential operation. - Required. - :type credential_name: str - :param parameters: The parameters supplied to the create or update credential operation. - 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: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - credential_name: str, - parameters: Union[_models.CredentialCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Credential: - """Create a credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The parameters supplied to the create or update credential operation. - Required. - :type credential_name: str - :param parameters: The parameters supplied to the create or update credential operation. Is - either a CredentialCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters or IO[bytes] - :return: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CredentialCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - credential_name=credential_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("Credential", 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, - credential_name: str, - parameters: _models.CredentialUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Credential: - """Update a credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The parameters supplied to the Update credential operation. Required. - :type credential_name: str - :param parameters: The parameters supplied to the Update credential operation. Required. - :type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - credential_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Credential: - """Update a credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The parameters supplied to the Update credential operation. Required. - :type credential_name: str - :param parameters: The parameters supplied to the Update credential operation. 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: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - automation_account_name: str, - credential_name: str, - parameters: Union[_models.CredentialUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Credential: - """Update a credential. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param credential_name: The parameters supplied to the Update credential operation. Required. - :type credential_name: str - :param parameters: The parameters supplied to the Update credential operation. Is either a - CredentialUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters or IO[bytes] - :return: Credential or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Credential - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CredentialUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - credential_name=credential_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("Credential", 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 - ) -> ItemPaged["_models.Credential"]: - """Retrieve a list of credentials. - - .. seealso:: - - http://aka.ms/azureautomationsdk/credentialoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Credential or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Credential] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("CredentialListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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/_dsc_compilation_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_operations.py deleted file mode 100644 index 4c8ba33b31eb..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_operations.py +++ /dev/null @@ -1,651 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, 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 -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request( - resource_group_name: str, - automation_account_name: str, - compilation_job_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/compilationjobs/{compilationJobName}", - ) - 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"), - "compilationJobName": _SERIALIZER.url("compilation_job_name", compilation_job_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - automation_account_name: str, - compilation_job_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "compilationJobName": _SERIALIZER.url("compilation_job_name", compilation_job_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_automation_account_request( - resource_group_name: str, - automation_account_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", "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", - ) - 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 - 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) - - -def build_get_stream_request( - resource_group_name: str, - automation_account_name: str, - job_id: str, - job_stream_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", "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}", - ) - 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"), - "jobId": _SERIALIZER.url("job_id", job_id, "str"), - "jobStreamId": _SERIALIZER.url("job_stream_id", job_stream_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) - - -class DscCompilationJobOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`dsc_compilation_job` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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, - resource_group_name: str, - automation_account_name: str, - compilation_job_name: str, - parameters: Union[_models.DscCompilationJobCreateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - 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, "DscCompilationJobCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - compilation_job_name=compilation_job_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 [201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - automation_account_name: str, - compilation_job_name: str, - parameters: _models.DscCompilationJobCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DscCompilationJob]: - """Creates the Dsc compilation job of the configuration. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param compilation_job_name: The DSC configuration Id. Required. - :type compilation_job_name: str - :param parameters: The parameters supplied to the create compilation job operation. Required. - :type parameters: ~azure.mgmt.automation.models.DscCompilationJobCreateParameters - :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 DscCompilationJob or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.DscCompilationJob] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - automation_account_name: str, - compilation_job_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DscCompilationJob]: - """Creates the Dsc compilation job of the configuration. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param compilation_job_name: The DSC configuration Id. Required. - :type compilation_job_name: str - :param parameters: The parameters supplied to the create compilation job operation. 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 DscCompilationJob or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.DscCompilationJob] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - automation_account_name: str, - compilation_job_name: str, - parameters: Union[_models.DscCompilationJobCreateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DscCompilationJob]: - """Creates the Dsc compilation job of the configuration. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param compilation_job_name: The DSC configuration Id. Required. - :type compilation_job_name: str - :param parameters: The parameters supplied to the create compilation job operation. Is either a - DscCompilationJobCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.DscCompilationJobCreateParameters or IO[bytes] - :return: An instance of LROPoller that returns either DscCompilationJob or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.DscCompilationJob] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-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) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - compilation_job_name=compilation_job_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("DscCompilationJob", 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.DscCompilationJob].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DscCompilationJob]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, compilation_job_name: str, **kwargs: Any - ) -> _models.DscCompilationJob: - """Retrieve the Dsc configuration compilation job identified by job id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dsccompilationjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param compilation_job_name: The DSC configuration Id. Required. - :type compilation_job_name: str - :return: DscCompilationJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscCompilationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - compilation_job_name=compilation_job_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("DscCompilationJob", 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, filter: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.DscCompilationJob"]: - """Retrieve a list of dsc compilation jobs. - - .. seealso:: - - http://aka.ms/azureautomationsdk/compilationjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 DscCompilationJob or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.DscCompilationJob] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscCompilationJobListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("DscCompilationJobListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_stream( - self, resource_group_name: str, automation_account_name: str, job_id: str, job_stream_id: str, **kwargs: Any - ) -> _models.JobStream: - """Retrieve the job stream identified by job stream id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobstreamoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_id: The job id. Required. - :type job_id: str - :param job_stream_id: The job stream id. Required. - :type job_stream_id: str - :return: JobStream or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobStream - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) - - _request = build_get_stream_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_id=job_id, - job_stream_id=job_stream_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("JobStream", 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_stream_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_stream_operations.py deleted file mode 100644 index d8e1c213876e..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_stream_operations.py +++ /dev/null @@ -1,156 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_job_request( - resource_group_name: str, automation_account_name: str, job_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", "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", - ) - 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"), - "jobId": _SERIALIZER.url("job_id", job_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) - - -class DscCompilationJobStreamOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`dsc_compilation_job_stream` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, job_id: str, **kwargs: Any - ) -> _models.JobStreamListResult: - """Retrieve all the job streams for the compilation Job. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobstreamoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_id: The job id. Required. - :type job_id: str - :return: JobStreamListResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobStreamListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) - - _request = build_list_by_job_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_id=job_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("JobStreamListResult", 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_configuration_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_configuration_operations.py deleted file mode 100644 index c95438335db1..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_configuration_operations.py +++ /dev/null @@ -1,883 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, 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 -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, automation_account_name: str, configuration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, automation_account_name: str, configuration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, automation_account_name: str, configuration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/configurations/{configurationName}", - ) - 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"), - "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, automation_account_name: str, configuration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/configurations/{configurationName}", - ) - 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"), - "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_content_request( - resource_group_name: str, automation_account_name: str, configuration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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", - ) - 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"), - "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_automation_account_request( - resource_group_name: str, - automation_account_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - skip: Optional[int] = None, - top: Optional[int] = None, - inlinecount: 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", "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", - ) - 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") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if skip is not None: - _params["$skip"] = _SERIALIZER.query("skip", skip, "int") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if inlinecount is not None: - _params["$inlinecount"] = _SERIALIZER.query("inlinecount", inlinecount, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class DscConfigurationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`dsc_configuration` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - self, resource_group_name: str, automation_account_name: str, configuration_name: str, **kwargs: Any - ) -> None: - """Delete the dsc configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The configuration name. Required. - :type configuration_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - configuration_name=configuration_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, configuration_name: str, **kwargs: Any - ) -> _models.DscConfiguration: - """Retrieve the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The configuration name. Required. - :type configuration_name: str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - configuration_name=configuration_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("DscConfiguration", 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, - configuration_name: str, - parameters: _models.DscConfigurationCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DscConfiguration: - """Create the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The create or update parameters for configuration. Required. - :type configuration_name: str - :param parameters: The create or update parameters for configuration. Required. - :type parameters: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - configuration_name: str, - parameters: str, - *, - content_type: Optional[str] = None, - **kwargs: Any - ) -> _models.DscConfiguration: - """Create the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The create or update parameters for configuration. Required. - :type configuration_name: str - :param parameters: The create or update parameters for configuration. Required. - :type parameters: str - :keyword content_type: Body Parameter content-type. Content type parameter for string body. - Default value is None. - :paramtype content_type: str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - configuration_name: str, - parameters: Union[_models.DscConfigurationCreateOrUpdateParameters, str], - **kwargs: Any - ) -> _models.DscConfiguration: - """Create the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The create or update parameters for configuration. Required. - :type configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a - DscConfigurationCreateOrUpdateParameters type or a str type. Required. - :type parameters: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters or str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - _json = None - _content = None - if isinstance(parameters, msrest.Model): - content_type = content_type or "application/json" - _json = self._serialize.body(parameters, "DscConfigurationCreateOrUpdateParameters") - elif isinstance(parameters, str): - _content = self._serialize.body(parameters, "str") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - configuration_name=configuration_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("DscConfiguration", 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, - configuration_name: str, - parameters: Optional[_models.DscConfigurationUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DscConfiguration: - """Create the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The create or update parameters for configuration. Required. - :type configuration_name: str - :param parameters: The create or update parameters for configuration. Default value is None. - :type parameters: ~azure.mgmt.automation.models.DscConfigurationUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - configuration_name: str, - parameters: Optional[str] = None, - *, - content_type: Optional[str] = None, - **kwargs: Any - ) -> _models.DscConfiguration: - """Create the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The create or update parameters for configuration. Required. - :type configuration_name: str - :param parameters: The create or update parameters for configuration. Default value is None. - :type parameters: str - :keyword content_type: Body Parameter content-type. Content type parameter for string body. - Default value is None. - :paramtype content_type: str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - automation_account_name: str, - configuration_name: str, - parameters: Optional[Union[_models.DscConfigurationUpdateParameters, str]] = None, - **kwargs: Any - ) -> _models.DscConfiguration: - """Create the configuration identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The create or update parameters for configuration. Required. - :type configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a - DscConfigurationUpdateParameters type or a str type. Default value is None. - :type parameters: ~azure.mgmt.automation.models.DscConfigurationUpdateParameters or str - :return: DscConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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" if parameters else None - if parameters is not None: - _json = self._serialize.body(parameters, "DscConfigurationUpdateParameters") - else: - _json = None - elif isinstance(parameters, str): - if parameters is not None: - _content = self._serialize.body(parameters, "str") - else: - _content = None - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - configuration_name=configuration_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("DscConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_content( - self, resource_group_name: str, automation_account_name: str, configuration_name: str, **kwargs: Any - ) -> Iterator[bytes]: - """Retrieve the configuration script identified by configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param configuration_name: The configuration name. Required. - :type configuration_name: str - :return: Iterator[bytes] or the result of cls(response) - :rtype: Iterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - configuration_name=configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - 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, - filter: Optional[str] = None, - skip: Optional[int] = None, - top: Optional[int] = None, - inlinecount: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.DscConfiguration"]: - """Retrieve a list of configurations. - - .. seealso:: - - http://aka.ms/azureautomationsdk/configurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :param skip: The number of rows to skip. Default value is None. - :type skip: int - :param top: The number of rows to take. Default value is None. - :type top: int - :param inlinecount: Return total rows. Default value is None. - :type inlinecount: str - :return: An iterator like instance of either DscConfiguration or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.DscConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - filter=filter, - skip=skip, - top=top, - inlinecount=inlinecount, - 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("DscConfigurationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_dsc_node_configuration_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_configuration_operations.py deleted file mode 100644 index cea9b7e4e8bf..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_configuration_operations.py +++ /dev/null @@ -1,669 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, 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 -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, - automation_account_name: str, - node_configuration_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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}", - ) - 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"), - "nodeConfigurationName": _SERIALIZER.url("node_configuration_name", node_configuration_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - automation_account_name: str, - node_configuration_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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}", - ) - 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"), - "nodeConfigurationName": _SERIALIZER.url("node_configuration_name", node_configuration_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - automation_account_name: str, - node_configuration_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/nodeConfigurations/{nodeConfigurationName}", - ) - 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"), - "nodeConfigurationName": _SERIALIZER.url("node_configuration_name", node_configuration_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_automation_account_request( - resource_group_name: str, - automation_account_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - skip: Optional[int] = None, - top: Optional[int] = None, - inlinecount: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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", - ) - 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") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if skip is not None: - _params["$skip"] = _SERIALIZER.query("skip", skip, "int") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if inlinecount is not None: - _params["$inlinecount"] = _SERIALIZER.query("inlinecount", inlinecount, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class DscNodeConfigurationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`dsc_node_configuration` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - self, resource_group_name: str, automation_account_name: str, node_configuration_name: str, **kwargs: Any - ) -> None: - """Delete the Dsc node configurations by node configuration. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeconfigurations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_configuration_name: The Dsc node configuration name. Required. - :type node_configuration_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_configuration_name=node_configuration_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, node_configuration_name: str, **kwargs: Any - ) -> _models.DscNodeConfiguration: - """Retrieve the Dsc node configurations by node configuration. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeconfigurations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_configuration_name: The Dsc node configuration name. Required. - :type node_configuration_name: str - :return: DscNodeConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNodeConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNodeConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_configuration_name=node_configuration_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("DscNodeConfiguration", 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, - node_configuration_name: str, - parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - 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, "DscNodeConfigurationCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_configuration_name=node_configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - 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, - node_configuration_name: str, - parameters: _models.DscNodeConfigurationCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DscNodeConfiguration]: - """Create the node configuration identified by node configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeconfigurations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_configuration_name: The Dsc node configuration name. Required. - :type node_configuration_name: str - :param parameters: The create or update parameters for configuration. Required. - :type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters - :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 DscNodeConfiguration or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - node_configuration_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DscNodeConfiguration]: - """Create the node configuration identified by node configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeconfigurations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_configuration_name: The Dsc node configuration name. Required. - :type node_configuration_name: str - :param parameters: The create or update parameters for configuration. 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 DscNodeConfiguration or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - node_configuration_name: str, - parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DscNodeConfiguration]: - """Create the node configuration identified by node configuration name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeconfigurations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_configuration_name: The Dsc node configuration name. Required. - :type node_configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a - DscNodeConfigurationCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters or - IO[bytes] - :return: An instance of LROPoller that returns either DscNodeConfiguration or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-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) - lro_delay = kwargs.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, - node_configuration_name=node_configuration_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("DscNodeConfiguration", 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.DscNodeConfiguration].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DscNodeConfiguration]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_by_automation_account( - self, - resource_group_name: str, - automation_account_name: str, - filter: Optional[str] = None, - skip: Optional[int] = None, - top: Optional[int] = None, - inlinecount: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.DscNodeConfiguration"]: - """Retrieve a list of dsc node configurations. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeconfigurations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :param skip: The number of rows to skip. Default value is None. - :type skip: int - :param top: The number of rows to take. Default value is None. - :type top: int - :param inlinecount: Return total rows. Default value is None. - :type inlinecount: str - :return: An iterator like instance of either DscNodeConfiguration or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.DscNodeConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNodeConfigurationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - filter=filter, - skip=skip, - top=top, - inlinecount=inlinecount, - 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("DscNodeConfigurationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_dsc_node_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_operations.py deleted file mode 100644 index 1a15e89e8604..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_operations.py +++ /dev/null @@ -1,592 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, automation_account_name: str, node_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", "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}", - ) - 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"), - "nodeId": _SERIALIZER.url("node_id", node_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, node_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", "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}", - ) - 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"), - "nodeId": _SERIALIZER.url("node_id", node_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_update_request( - resource_group_name: str, automation_account_name: str, node_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", "2018-01-15")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/nodes/{nodeId}", - ) - 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"), - "nodeId": _SERIALIZER.url("node_id", node_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="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, - *, - filter: Optional[str] = None, - skip: Optional[int] = None, - top: Optional[int] = None, - inlinecount: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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", - ) - 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 - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if skip is not None: - _params["$skip"] = _SERIALIZER.query("skip", skip, "int") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if inlinecount is not None: - _params["$inlinecount"] = _SERIALIZER.query("inlinecount", inlinecount, "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 DscNodeOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`dsc_node` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, node_id: str, **kwargs: Any - ) -> _models.DscNode: - """Delete the dsc node identified by node id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: The node id. Required. - :type node_id: str - :return: DscNode or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNode - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_id=node_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("DscNode", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, node_id: str, **kwargs: Any - ) -> _models.DscNode: - """Retrieve the dsc node identified by node id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: The node id. Required. - :type node_id: str - :return: DscNode or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNode - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_id=node_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("DscNode", 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, - node_id: str, - dsc_node_update_parameters: _models.DscNodeUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DscNode: - """Update the dsc node. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: Parameters supplied to the update dsc node. Required. - :type node_id: str - :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Required. - :type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DscNode or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNode - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - node_id: str, - dsc_node_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DscNode: - """Update the dsc node. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: Parameters supplied to the update dsc node. Required. - :type node_id: str - :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Required. - :type dsc_node_update_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: DscNode or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNode - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - automation_account_name: str, - node_id: str, - dsc_node_update_parameters: Union[_models.DscNodeUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.DscNode: - """Update the dsc node. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: Parameters supplied to the update dsc node. Required. - :type node_id: str - :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Is either a - DscNodeUpdateParameters type or a IO[bytes] type. Required. - :type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters or - IO[bytes] - :return: DscNode or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNode - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dsc_node_update_parameters, (IOBase, bytes)): - _content = dsc_node_update_parameters - else: - _json = self._serialize.body(dsc_node_update_parameters, "DscNodeUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_id=node_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) - - deserialized = self._deserialize("DscNode", 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, - filter: Optional[str] = None, - skip: Optional[int] = None, - top: Optional[int] = None, - inlinecount: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.DscNode"]: - """Retrieve a list of dsc nodes. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :param skip: The number of rows to skip. Default value is None. - :type skip: int - :param top: The number of rows to take. Default value is None. - :type top: int - :param inlinecount: Return total rows. Default value is None. - :type inlinecount: str - :return: An iterator like instance of either DscNode or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.DscNode] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNodeListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - filter=filter, - skip=skip, - top=top, - inlinecount=inlinecount, - 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("DscNodeListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_fields_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_fields_operations.py deleted file mode 100644 index 3d06567a2e9a..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_fields_operations.py +++ /dev/null @@ -1,181 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_type_request( - resource_group_name: str, - automation_account_name: str, - module_name: str, - type_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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", - ) - 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"), - "moduleName": _SERIALIZER.url("module_name", module_name, "str"), - "typeName": _SERIALIZER.url("type_name", type_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_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 FieldsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`fields` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - ) -> ItemPaged["_models.TypeField"]: - """Retrieve a list of fields of a given type identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/typefieldoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param type_name: The name of type. Required. - :type type_name: str - :return: An iterator like instance of either TypeField or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.TypeField] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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_type_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - type_name=type_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("TypeFieldListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/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 deleted file mode 100644 index 6824796e6d1b..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_worker_group_operations.py +++ /dev/null @@ -1,590 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_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, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}", - ) - 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 - _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, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}", - ) - 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 - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - 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", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}", - ) - 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="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, - *, - 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", "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", - ) - 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 - 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 HybridRunbookWorkerGroupOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`hybrid_runbook_worker_group` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - **kwargs: Any - ) -> None: - """Delete a hybrid runbook worker group. - - .. seealso:: - - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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 - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - 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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - **kwargs: Any - ) -> _models.HybridRunbookWorkerGroup: - """Retrieve a hybrid runbook worker group. - - .. seealso:: - - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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 - :return: HybridRunbookWorkerGroup or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - 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, - 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("HybridRunbookWorkerGroup", 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, - hybrid_runbook_worker_group_name: str, - parameters: _models.HybridRunbookWorkerGroupUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridRunbookWorkerGroup: - """Update a hybrid runbook worker group. - - .. seealso:: - - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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 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 - :return: HybridRunbookWorkerGroup or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridRunbookWorkerGroup: - """Update a hybrid runbook worker group. - - .. seealso:: - - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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 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 - :return: HybridRunbookWorkerGroup or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - automation_account_name: str, - hybrid_runbook_worker_group_name: str, - parameters: Union[_models.HybridRunbookWorkerGroupUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.HybridRunbookWorkerGroup: - """Update a hybrid runbook worker group. - - .. seealso:: - - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "HybridRunbookWorkerGroupUpdateParameters") - - _request = build_update_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]: - map_error(status_code=response.status_code, response=response, error_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 - - @distributed_trace - def list_by_automation_account( - self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.HybridRunbookWorkerGroup"]: - """Retrieve a list of hybrid runbook worker groups. - - .. seealso:: - - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 HybridRunbookWorkerGroup or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.HybridRunbookWorkerGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("HybridRunbookWorkerGroupsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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 deleted file mode 100644 index fe0b2ecb9ae0..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_operations.py +++ /dev/null @@ -1,1087 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -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 -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_output_request( - resource_group_name: str, - automation_account_name: str, - job_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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", - ) - 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"), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_runbook_content_request( - resource_group_name: str, - automation_account_name: str, - job_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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", - ) - 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"), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_suspend_request( - resource_group_name: str, - automation_account_name: str, - job_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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", - ) - 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"), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - automation_account_name: str, - job_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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", - ) - 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"), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - automation_account_name: str, - job_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _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, - job_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/jobs/{jobName}", - ) - 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"), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_automation_account_request( - resource_group_name: str, - automation_account_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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", - ) - 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 - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_resume_request( - resource_group_name: str, - automation_account_name: str, - job_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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", - ) - 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"), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class JobOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`job` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - """Retrieve the job output identified by job name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The name of the job to be created. Required. - :type job_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: Iterator[bytes] or the result of cls(response) - :rtype: Iterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_runbook_content( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - """Retrieve the runbook content of the job identified by job name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: Iterator[bytes] or the result of cls(response) - :rtype: Iterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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 suspend( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """Suspend the job identified by job name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """Stop the job identified by jobName. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.Job: - """Retrieve the job identified by job name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: Job or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Job - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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("Job", 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, - job_name: str, - parameters: _models.JobCreateParameters, - client_request_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Job: - """Create a job of the runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param parameters: The parameters supplied to the create job operation. Required. - :type parameters: ~azure.mgmt.automation.models.JobCreateParameters - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Job or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Job - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - parameters: IO[bytes], - client_request_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Job: - """Create a job of the runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param parameters: The parameters supplied to the create job operation. Required. - :type parameters: IO[bytes] - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Job or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Job - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - parameters: Union[_models.JobCreateParameters, IO[bytes]], - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.Job: - """Create a job of the runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param parameters: The parameters supplied to the create job operation. Is either a - JobCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.JobCreateParameters or IO[bytes] - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: Job or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Job - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "JobCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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 [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("Job", 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, - filter: Optional[str] = None, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.JobCollectionItem"]: - """Retrieve a list of jobs. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: An iterator like instance of either JobCollectionItem or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.JobCollectionItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - filter=filter, - client_request_id=client_request_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("JobListResultV2", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def resume( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """Resume the job identified by jobName. - - .. seealso:: - - http://aka.ms/azureautomationsdk/joboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore 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 deleted file mode 100644 index 6e4a44bb4a05..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_schedule_operations.py +++ /dev/null @@ -1,562 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, automation_account_name: str, job_schedule_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", "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}", - ) - 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"), - "jobScheduleId": _SERIALIZER.url("job_schedule_id", job_schedule_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, job_schedule_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", "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}", - ) - 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"), - "jobScheduleId": _SERIALIZER.url("job_schedule_id", job_schedule_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, job_schedule_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", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/jobSchedules/{jobScheduleId}", - ) - 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"), - "jobScheduleId": _SERIALIZER.url("job_schedule_id", job_schedule_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_list_by_automation_account_request( - resource_group_name: str, - automation_account_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", "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", - ) - 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 - 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 JobScheduleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`job_schedule` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - 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. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobscheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_schedule_id: The job schedule name. Required. - :type job_schedule_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_schedule_id=job_schedule_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, job_schedule_id: str, **kwargs: Any - ) -> _models.JobSchedule: - """Retrieve the job schedule identified by job schedule name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobscheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_schedule_id: The job schedule name. Required. - :type job_schedule_id: str - :return: JobSchedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobSchedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_schedule_id=job_schedule_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("JobSchedule", 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, - job_schedule_id: str, - parameters: _models.JobScheduleCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.JobSchedule: - """Create a job schedule. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobscheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_schedule_id: The job schedule name. Required. - :type job_schedule_id: str - :param parameters: The parameters supplied to the create job schedule operation. Required. - :type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: JobSchedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobSchedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - automation_account_name: str, - job_schedule_id: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.JobSchedule: - """Create a job schedule. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobscheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_schedule_id: The job schedule name. Required. - :type job_schedule_id: str - :param parameters: The parameters supplied to the create job schedule operation. 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: JobSchedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobSchedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - automation_account_name: str, - job_schedule_id: str, - parameters: Union[_models.JobScheduleCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.JobSchedule: - """Create a job schedule. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobscheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_schedule_id: The job schedule name. Required. - :type job_schedule_id: str - :param parameters: The parameters supplied to the create job schedule operation. Is either a - JobScheduleCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters or IO[bytes] - :return: JobSchedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobSchedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "JobScheduleCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_schedule_id=job_schedule_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 [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("JobSchedule", 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, filter: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.JobSchedule"]: - """Retrieve a list of job schedules. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobscheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 JobSchedule or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.JobSchedule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("JobScheduleListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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_stream_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_stream_operations.py deleted file mode 100644 index c7712af0490f..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_stream_operations.py +++ /dev/null @@ -1,317 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - automation_account_name: str, - job_name: str, - job_stream_id: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), - "jobStreamId": _SERIALIZER.url("job_stream_id", job_stream_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_job_request( - resource_group_name: str, - automation_account_name: str, - job_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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", - ) - 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"), - "jobName": _SERIALIZER.url("job_name", job_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 - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class JobStreamOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`job_stream` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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, - job_name: str, - job_stream_id: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.JobStream: - """Retrieve the job stream identified by job stream id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobstreamoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param job_stream_id: The job stream id. Required. - :type job_stream_id: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: JobStream or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobStream - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - job_stream_id=job_stream_id, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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("JobStream", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_job( - self, - resource_group_name: str, - automation_account_name: str, - job_name: str, - filter: Optional[str] = None, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.JobStream"]: - """Retrieve a list of jobs streams identified by job name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobstreamoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param job_name: The job name. Required. - :type job_name: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: An iterator like instance of either JobStream or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.JobStream] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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_job_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - filter=filter, - client_request_id=client_request_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("JobStreamListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_keys_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_keys_operations.py deleted file mode 100644 index 35d28f436823..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_keys_operations.py +++ /dev/null @@ -1,149 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_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", "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", - ) - 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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class KeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - ) -> _models.KeyListResult: - """Retrieve the automation keys for an 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: KeyListResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.KeyListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - 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/_linked_workspace_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_linked_workspace_operations.py deleted file mode 100644 index 913add9b5ae4..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_linked_workspace_operations.py +++ /dev/null @@ -1,150 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_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", "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", - ) - 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 LinkedWorkspaceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`linked_workspace` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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: - """Retrieve the linked workspace for the account id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/linkedworkspaceoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: LinkedWorkspace or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.LinkedWorkspace - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - 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/_module_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_module_operations.py deleted file mode 100644 index 2e8fcdfc0bb1..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_module_operations.py +++ /dev/null @@ -1,739 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, automation_account_name: str, module_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "moduleName": _SERIALIZER.url("module_name", module_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, automation_account_name: str, module_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "moduleName": _SERIALIZER.url("module_name", module_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, automation_account_name: str, module_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/modules/{moduleName}", - ) - 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"), - "moduleName": _SERIALIZER.url("module_name", module_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, automation_account_name: str, module_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/modules/{moduleName}", - ) - 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"), - "moduleName": _SERIALIZER.url("module_name", module_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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", "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", - ) - 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 ModuleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`module` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any - ) -> None: - """Delete the module by name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The module name. Required. - :type module_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any - ) -> _models.Module: - """Retrieve the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The module name. Required. - :type module_name: str - :return: Module or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Module - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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, - module_name: str, - parameters: _models.ModuleCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Module: - """Create or Update the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param parameters: The create or update parameters for module. Required. - :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Module or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Module - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - module_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Module: - """Create or Update the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param parameters: The create or update parameters for module. 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, - module_name: str, - parameters: Union[_models.ModuleCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Module: - """Create or Update the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param parameters: The create or update parameters for module. Is either a - ModuleCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ModuleCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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, - module_name: str, - parameters: _models.ModuleUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Module: - """Update the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param parameters: The update parameters for module. Required. - :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Module or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Module - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - module_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Module: - """Update the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param parameters: The update parameters for module. 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, - module_name: str, - parameters: Union[_models.ModuleUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Module: - """Update the module identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param parameters: The update parameters for module. Is either a ModuleUpdateParameters type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ModuleUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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 - ) -> ItemPaged["_models.Module"]: - """Retrieve a list of modules. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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", "2015-10-31")) - cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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/_node_count_information_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_count_information_operations.py deleted file mode 100644 index 62f9828de1f3..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_count_information_operations.py +++ /dev/null @@ -1,165 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar, Union - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - automation_account_name: str, - count_type: Union[str, _models.CountType], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-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}", - ) - 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"), - "countType": _SERIALIZER.url("count_type", count_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_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 NodeCountInformationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`node_count_information` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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, - count_type: Union[str, _models.CountType], - **kwargs: Any - ) -> _models.NodeCounts: - """Retrieve counts for Dsc Nodes. - - .. seealso:: - - http://aka.ms/azureautomationsdk/nodecounts - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param count_type: The type of counts to retrieve. Known values are: "status" and - "nodeconfiguration". Required. - :type count_type: str or ~azure.mgmt.automation.models.CountType - :return: NodeCounts or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.NodeCounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.NodeCounts] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - count_type=count_type, - 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("NodeCounts", 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/_node_reports_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_reports_operations.py deleted file mode 100644 index eb22309a8345..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_reports_operations.py +++ /dev/null @@ -1,407 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_node_request( - resource_group_name: str, - automation_account_name: str, - node_id: 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", "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", - ) - 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"), - "nodeId": _SERIALIZER.url("node_id", node_id, "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) - - -def build_get_request( - resource_group_name: str, - automation_account_name: str, - node_id: str, - report_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", "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}", - ) - 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"), - "nodeId": _SERIALIZER.url("node_id", node_id, "str"), - "reportId": _SERIALIZER.url("report_id", report_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_get_content_request( - resource_group_name: str, - automation_account_name: str, - node_id: str, - report_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", "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", - ) - 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"), - "nodeId": _SERIALIZER.url("node_id", node_id, "str"), - "reportId": _SERIALIZER.url("report_id", report_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) - - -class NodeReportsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`node_reports` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - node_id: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.DscNodeReport"]: - """Retrieve the Dsc node report list by node id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodereportoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: The parameters supplied to the list operation. Required. - :type node_id: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :return: An iterator like instance of either DscNodeReport or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.DscNodeReport] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNodeReportListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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_node_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_id=node_id, - 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("DscNodeReportListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, node_id: str, report_id: str, **kwargs: Any - ) -> _models.DscNodeReport: - """Retrieve the Dsc node report data by node id and report id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodereportoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: The Dsc node id. Required. - :type node_id: str - :param report_id: The report id. Required. - :type report_id: str - :return: DscNodeReport or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.DscNodeReport - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[_models.DscNodeReport] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_id=node_id, - report_id=report_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("DscNodeReport", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_content( - self, resource_group_name: str, automation_account_name: str, node_id: str, report_id: str, **kwargs: Any - ) -> JSON: - """Retrieve the Dsc node reports by node id and report id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/dscnodereportoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param node_id: The Dsc node id. Required. - :type node_id: str - :param report_id: The report id. Required. - :type report_id: str - :return: JSON or the result of cls(response) - :rtype: JSON - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-15")) - cls: ClsType[JSON] = kwargs.pop("cls", None) - - _request = build_get_content_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - node_id=node_id, - report_id=report_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("object", 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/_object_data_types_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_object_data_types_operations.py deleted file mode 100644 index fff0590faad5..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_object_data_types_operations.py +++ /dev/null @@ -1,296 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_fields_by_module_and_type_request( # pylint: disable=name-too-long - resource_group_name: str, - automation_account_name: str, - module_name: str, - type_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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", - ) - 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"), - "moduleName": _SERIALIZER.url("module_name", module_name, "str"), - "typeName": _SERIALIZER.url("type_name", type_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_fields_by_type_request( - resource_group_name: str, automation_account_name: str, type_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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", - ) - 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"), - "typeName": _SERIALIZER.url("type_name", type_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_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 ObjectDataTypesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`object_data_types` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - ) -> ItemPaged["_models.TypeField"]: - """Retrieve a list of fields of a given type identified by module name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/objectdatatypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param module_name: The name of module. Required. - :type module_name: str - :param type_name: The name of type. Required. - :type type_name: str - :return: An iterator like instance of either TypeField or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.TypeField] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_fields_by_module_and_type_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - module_name=module_name, - type_name=type_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("TypeFieldListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_fields_by_type( - self, resource_group_name: str, automation_account_name: str, type_name: str, **kwargs: Any - ) -> ItemPaged["_models.TypeField"]: - """Retrieve a list of fields of a given type across all accessible modules. - - .. seealso:: - - http://aka.ms/azureautomationsdk/objectdatatypeoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param type_name: The name of type. Required. - :type type_name: str - :return: An iterator like instance of either TypeField or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.TypeField] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_fields_by_type_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - type_name=type_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("TypeFieldListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_operations.py index 3200e926c354..d712b92df039 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,12 +1,16 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core import PipelineClient from azure.core.exceptions import ( @@ -15,36 +19,43 @@ 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 .._configuration import AutomationClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer +from .._utils.utils import ClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Automation/operations") + _url = "/providers/Microsoft.Automation/operations" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -55,6 +66,5410 @@ def build_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_software_update_configurations_get_by_name_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + software_update_configuration_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "softwareUpdateConfigurationName": _SERIALIZER.url( + "software_update_configuration_name", software_update_configuration_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_software_update_configurations_create_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + software_update_configuration_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "softwareUpdateConfigurationName": _SERIALIZER.url( + "software_update_configuration_name", software_update_configuration_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_software_update_configurations_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + software_update_configuration_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "softwareUpdateConfigurationName": _SERIALIZER.url( + "software_update_configuration_name", software_update_configuration_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_software_update_configurations_list_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_hybrid_runbook_workers_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_hybrid_runbook_workers_create_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_hybrid_runbook_workers_patch_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_hybrid_runbook_workers_delete_request( # pylint: disable=name-too-long + 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: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_hybrid_runbook_workers_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "hybridRunbookWorkerGroupName": _SERIALIZER.url( + "hybrid_runbook_worker_group_name", hybrid_runbook_worker_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_hybrid_runbook_workers_move_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}/move" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_python2_package_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_python2_package_create_or_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_python2_package_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_python2_package_delete_request( + resource_group_name: str, automation_account_name: str, package_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_python2_package_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_python3_package_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python3Packages/{packageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_python3_package_create_or_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python3Packages/{packageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_python3_package_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python3Packages/{packageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_python3_package_delete_request( + resource_group_name: str, automation_account_name: str, package_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python3Packages/{packageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_python3_package_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python3Packages" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_runtime_environments_get_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url("runtime_environment_name", runtime_environment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_runtime_environments_create_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url("runtime_environment_name", runtime_environment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_runtime_environments_update_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url("runtime_environment_name", runtime_environment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_runtime_environments_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url("runtime_environment_name", runtime_environment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_runtime_environments_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_private_endpoint_connections_get_request( # pylint: disable=name-too-long + 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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_private_endpoint_connections_create_or_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_private_endpoint_connections_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_private_endpoint_connections_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_automation_account_get_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_automation_account_create_or_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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 + if content_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_automation_account_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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 + if content_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_automation_account_delete_request( + resource_group_name: str, automation_account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_automation_account_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_automation_account_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_automation_account_list_deleted_runbooks_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listDeletedRunbooks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_node_count_information_get_request( + resource_group_name: str, + automation_account_name: str, + count_type: Union[str, _models.CountType], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodecounts/{countType}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "countType": _SERIALIZER.url("count_type", count_type, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_link_resources_automation_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateLinkResources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_agent_registration_information_get_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_agent_registration_information_regenerate_key_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation/regenerateKey" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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 + if content_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_statistics_list_by_automation_account_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/statistics" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_usages_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/usages" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_keys_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listKeys" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_job_list_by_automation_account_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_job_get_request( + resource_group_name: str, + automation_account_name: str, + job_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_job_create_request( + resource_group_name: str, + automation_account_name: str, + job_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_job_get_output_request( + resource_group_name: str, + automation_account_name: str, + job_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "text/plain") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/output" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_job_get_runbook_content_request( + resource_group_name: str, + automation_account_name: str, + job_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "text/powershell") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/runbookContent" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_job_suspend_request( + resource_group_name: str, + automation_account_name: str, + job_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/suspend" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_job_stop_request( + resource_group_name: str, + automation_account_name: str, + job_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/stop" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_job_resume_request( + resource_group_name: str, + automation_account_name: str, + job_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/resume" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_linked_workspace_get_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/linkedWorkspace" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_object_data_types_list_fields_by_type_request( # pylint: disable=name-too-long + resource_group_name: str, automation_account_name: str, type_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/objectDataTypes/{typeName}/fields" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_object_data_types_list_fields_by_module_and_type_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + module_name: str, + type_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/objectDataTypes/{typeName}/fields" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "moduleName": _SERIALIZER.url("module_name", module_name, "str"), + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_software_update_configuration_machine_runs_get_by_id_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + software_update_configuration_machine_run_id: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns/{softwareUpdateConfigurationMachineRunId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "softwareUpdateConfigurationMachineRunId": _SERIALIZER.url( + "software_update_configuration_machine_run_id", software_update_configuration_machine_run_id, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_software_update_configuration_machine_runs_list_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + filter: Optional[str] = None, + skip: Optional[str] = None, + top: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_software_update_configuration_runs_get_by_id_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + software_update_configuration_run_id: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns/{softwareUpdateConfigurationRunId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "softwareUpdateConfigurationRunId": _SERIALIZER.url( + "software_update_configuration_run_id", software_update_configuration_run_id, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_software_update_configuration_runs_list_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + filter: Optional[str] = None, + skip: Optional[str] = None, + top: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_webhook_generate_uri_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", "2024-10-23")) + accept = _headers.pop("Accept", "text/plain") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/generateUri" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_webhook_get_request( + resource_group_name: str, automation_account_name: str, webhook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_webhook_create_or_update_request( + resource_group_name: str, automation_account_name: str, webhook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_webhook_update_request( + resource_group_name: str, automation_account_name: str, webhook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_webhook_delete_request( + resource_group_name: str, automation_account_name: str, webhook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_webhook_list_by_automation_account_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dsc_node_get_request( + resource_group_name: str, automation_account_name: str, node_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "nodeId": _SERIALIZER.url("node_id", node_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dsc_node_update_request( + resource_group_name: str, automation_account_name: str, node_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "nodeId": _SERIALIZER.url("node_id", node_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_dsc_node_delete_request( + resource_group_name: str, automation_account_name: str, node_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "nodeId": _SERIALIZER.url("node_id", node_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_dsc_node_list_by_automation_account_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + skip: Optional[int] = None, + top: Optional[int] = None, + inlinecount: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if inlinecount is not None: + _params["$inlinecount"] = _SERIALIZER.query("inlinecount", inlinecount, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_node_reports_list_by_node_request( + resource_group_name: str, + automation_account_name: str, + node_id: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "nodeId": _SERIALIZER.url("node_id", node_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_node_reports_get_request( + resource_group_name: str, + automation_account_name: str, + node_id: str, + report_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "nodeId": _SERIALIZER.url("node_id", node_id, "str"), + "reportId": _SERIALIZER.url("report_id", report_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_node_reports_get_content_request( + resource_group_name: str, + automation_account_name: str, + node_id: str, + report_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "text/plain") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}/content" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "nodeId": _SERIALIZER.url("node_id", node_id, "str"), + "reportId": _SERIALIZER.url("report_id", report_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificate_get_request( + resource_group_name: str, automation_account_name: str, certificate_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificate_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, automation_account_name: str, certificate_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificate_update_request( + resource_group_name: str, automation_account_name: str, certificate_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificate_delete_request( + resource_group_name: str, automation_account_name: str, certificate_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_certificate_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_connection_get_request( + resource_group_name: str, automation_account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, automation_account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_update_request( + resource_group_name: str, automation_account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_delete_request( + resource_group_name: str, automation_account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_connection_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_connection_type_get_request( + resource_group_name: str, + automation_account_name: str, + connection_type_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "connectionTypeName": _SERIALIZER.url("connection_type_name", connection_type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_type_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + connection_type_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "connectionTypeName": _SERIALIZER.url("connection_type_name", connection_type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_type_delete_request( + resource_group_name: str, + automation_account_name: str, + connection_type_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "connectionTypeName": _SERIALIZER.url("connection_type_name", connection_type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_connection_type_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_credential_get_request( + resource_group_name: str, automation_account_name: str, credential_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "credentialName": _SERIALIZER.url("credential_name", credential_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_credential_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, automation_account_name: str, credential_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "credentialName": _SERIALIZER.url("credential_name", credential_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_credential_update_request( + resource_group_name: str, automation_account_name: str, credential_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "credentialName": _SERIALIZER.url("credential_name", credential_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_credential_delete_request( + resource_group_name: str, automation_account_name: str, credential_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "credentialName": _SERIALIZER.url("credential_name", credential_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_credential_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_dsc_configuration_get_request( + resource_group_name: str, automation_account_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dsc_configuration_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, automation_account_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dsc_configuration_update_request( + resource_group_name: str, automation_account_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dsc_configuration_delete_request( + resource_group_name: str, automation_account_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_dsc_configuration_list_by_automation_account_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + skip: Optional[int] = None, + top: Optional[int] = None, + inlinecount: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if inlinecount is not None: + _params["$inlinecount"] = _SERIALIZER.query("inlinecount", inlinecount, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dsc_configuration_get_content_request( # pylint: disable=name-too-long + resource_group_name: str, automation_account_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "text/powershell") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}/content" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dsc_node_configuration_get_request( + resource_group_name: str, + automation_account_name: str, + node_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "nodeConfigurationName": _SERIALIZER.url("node_configuration_name", node_configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dsc_node_configuration_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + node_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "nodeConfigurationName": _SERIALIZER.url("node_configuration_name", node_configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dsc_node_configuration_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + node_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "nodeConfigurationName": _SERIALIZER.url("node_configuration_name", node_configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_dsc_node_configuration_list_by_automation_account_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + skip: Optional[int] = None, + top: Optional[int] = None, + inlinecount: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if inlinecount is not None: + _params["$inlinecount"] = _SERIALIZER.query("inlinecount", inlinecount, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_hybrid_runbook_worker_group_get_request( # pylint: disable=name-too-long + 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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "hybridRunbookWorkerGroupName": _SERIALIZER.url( + "hybrid_runbook_worker_group_name", hybrid_runbook_worker_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_hybrid_runbook_worker_group_create_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "hybridRunbookWorkerGroupName": _SERIALIZER.url( + "hybrid_runbook_worker_group_name", hybrid_runbook_worker_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_hybrid_runbook_worker_group_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "hybridRunbookWorkerGroupName": _SERIALIZER.url( + "hybrid_runbook_worker_group_name", hybrid_runbook_worker_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_hybrid_runbook_worker_group_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "hybridRunbookWorkerGroupName": _SERIALIZER.url( + "hybrid_runbook_worker_group_name", hybrid_runbook_worker_group_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_hybrid_runbook_worker_group_list_by_automation_account_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_job_stream_get_request( + resource_group_name: str, + automation_account_name: str, + job_name: str, + job_stream_id: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams/{jobStreamId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str"), + "jobStreamId": _SERIALIZER.url("job_stream_id", job_stream_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_job_stream_list_by_job_request( + resource_group_name: str, + automation_account_name: str, + job_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + if client_request_id is not None: + _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_job_schedule_get_request( + resource_group_name: str, automation_account_name: str, job_schedule_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "jobScheduleId": _SERIALIZER.url("job_schedule_id", job_schedule_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_job_schedule_create_request( + resource_group_name: str, automation_account_name: str, job_schedule_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "jobScheduleId": _SERIALIZER.url("job_schedule_id", job_schedule_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_job_schedule_delete_request( + resource_group_name: str, automation_account_name: str, job_schedule_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "jobScheduleId": _SERIALIZER.url("job_schedule_id", job_schedule_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_job_schedule_list_by_automation_account_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_module_get_request( + resource_group_name: str, automation_account_name: str, module_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "moduleName": _SERIALIZER.url("module_name", module_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_module_create_or_update_request( + resource_group_name: str, automation_account_name: str, module_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "moduleName": _SERIALIZER.url("module_name", module_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_module_update_request( + resource_group_name: str, automation_account_name: str, module_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "moduleName": _SERIALIZER.url("module_name", module_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_module_delete_request( + resource_group_name: str, automation_account_name: str, module_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "moduleName": _SERIALIZER.url("module_name", module_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_module_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_activity_get_request( + resource_group_name: str, + automation_account_name: str, + module_name: str, + activity_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities/{activityName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "moduleName": _SERIALIZER.url("module_name", module_name, "str"), + "activityName": _SERIALIZER.url("activity_name", activity_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_activity_list_by_module_request( + resource_group_name: str, automation_account_name: str, module_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "moduleName": _SERIALIZER.url("module_name", module_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fields_list_by_type_request( + resource_group_name: str, + automation_account_name: str, + module_name: str, + type_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/types/{typeName}/fields" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "moduleName": _SERIALIZER.url("module_name", module_name, "str"), + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_package_get_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url("runtime_environment_name", runtime_environment_name, "str"), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_package_create_or_update_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url("runtime_environment_name", runtime_environment_name, "str"), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_package_update_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url("runtime_environment_name", runtime_environment_name, "str"), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_package_delete_request( + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages/{packageName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url("runtime_environment_name", runtime_environment_name, "str"), + "packageName": _SERIALIZER.url("package_name", package_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_package_list_by_runtime_environment_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runtimeEnvironments/{runtimeEnvironmentName}/packages" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runtimeEnvironmentName": _SERIALIZER.url("runtime_environment_name", runtime_environment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_runbook_get_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_runbook_create_or_update_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_runbook_update_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_runbook_delete_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_runbook_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_runbook_publish_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/publish" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_runbook_get_content_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "text/plain") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_runbook_draft_get_content_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "text/plain") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_runbook_draft_replace_content_request( # pylint: disable=name-too-long + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: str = kwargs.pop("content_type") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_runbook_draft_get_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_runbook_draft_undo_edit_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_test_job_streams_get_request( + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + job_stream_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams/{jobStreamId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + "jobStreamId": _SERIALIZER.url("job_stream_id", job_stream_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_test_job_streams_list_by_test_job_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_test_job_create_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_test_job_get_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_test_job_resume_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/resume" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_test_job_stop_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/stop" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_test_job_suspend_request( + resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/suspend" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_schedule_get_request( + resource_group_name: str, automation_account_name: str, schedule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "scheduleName": _SERIALIZER.url("schedule_name", schedule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_schedule_create_or_update_request( + resource_group_name: str, automation_account_name: str, schedule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "scheduleName": _SERIALIZER.url("schedule_name", schedule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_schedule_update_request( + resource_group_name: str, automation_account_name: str, schedule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "scheduleName": _SERIALIZER.url("schedule_name", schedule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_schedule_delete_request( + resource_group_name: str, automation_account_name: str, schedule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "scheduleName": _SERIALIZER.url("schedule_name", schedule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_schedule_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_source_control_get_request( + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_source_control_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_source_control_update_request( + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_source_control_delete_request( + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_source_control_list_by_automation_account_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_source_control_sync_job_create_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), + "sourceControlSyncJobId": _SERIALIZER.url("source_control_sync_job_id", source_control_sync_job_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_source_control_sync_job_get_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), + "sourceControlSyncJobId": _SERIALIZER.url("source_control_sync_job_id", source_control_sync_job_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_source_control_sync_job_list_by_automation_account_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_source_control_sync_job_streams_list_by_sync_job_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), + "sourceControlSyncJobId": _SERIALIZER.url("source_control_sync_job_id", source_control_sync_job_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_source_control_sync_job_streams_get_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + stream_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams/{streamId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), + "sourceControlSyncJobId": _SERIALIZER.url("source_control_sync_job_id", source_control_sync_job_id, "str"), + "streamId": _SERIALIZER.url("stream_id", stream_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_variable_get_request( + resource_group_name: str, automation_account_name: str, variable_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_variable_create_or_update_request( + resource_group_name: str, automation_account_name: str, variable_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_variable_update_request( + resource_group_name: str, automation_account_name: str, variable_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_variable_delete_request( + resource_group_name: str, automation_account_name: str, variable_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_variable_list_by_automation_account_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", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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_watcher_get_request( + resource_group_name: str, automation_account_name: str, watcher_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "watcherName": _SERIALIZER.url("watcher_name", watcher_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_watcher_create_or_update_request( + resource_group_name: str, automation_account_name: str, watcher_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "watcherName": _SERIALIZER.url("watcher_name", watcher_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_watcher_update_request( + resource_group_name: str, automation_account_name: str, watcher_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "watcherName": _SERIALIZER.url("watcher_name", watcher_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_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_watcher_delete_request( + resource_group_name: str, automation_account_name: str, watcher_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "watcherName": _SERIALIZER.url("watcher_name", watcher_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_watcher_list_by_automation_account_request( # pylint: disable=name-too-long + resource_group_name: str, + automation_account_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_watcher_start_request( + resource_group_name: str, automation_account_name: str, watcher_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/start" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "watcherName": _SERIALIZER.url("watcher_name", watcher_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_watcher_stop_request( + resource_group_name: str, automation_account_name: str, watcher_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/stop" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), + "watcherName": _SERIALIZER.url("watcher_name", watcher_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_deleted_automation_accounts_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Automation/deletedAutomationAccounts" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_automation_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-23")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/convertGraphRunbookContent" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "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 + if content_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 Operations: """ .. warning:: @@ -62,11 +5477,19445 @@ class Operations: Instead, you should access the following operations through :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`operations` attribute. + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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) -> ItemPaged["_models.Operation"]: + """Lists all of the available Automation REST API operations. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SoftwareUpdateConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`software_update_configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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_name( + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfiguration: + """Get a single software update configuration by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_name: The name of the software update configuration to be + created. Required. + :type software_update_configuration_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: SoftwareUpdateConfiguration. The SoftwareUpdateConfiguration is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) + + _request = build_software_update_configurations_get_by_name_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + software_update_configuration_name=software_update_configuration_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfiguration, response.json()) + + 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, + software_update_configuration_name: str, + parameters: _models.SoftwareUpdateConfiguration, + *, + client_request_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SoftwareUpdateConfiguration: + """Create a new software update configuration with the name given in the URI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_name: The name of the software update configuration to be + created. Required. + :type software_update_configuration_name: str + :param parameters: Request body. Required. + :type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SoftwareUpdateConfiguration. The SoftwareUpdateConfiguration is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_name: str, + parameters: JSON, + *, + client_request_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SoftwareUpdateConfiguration: + """Create a new software update configuration with the name given in the URI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_name: The name of the software update configuration to be + created. Required. + :type software_update_configuration_name: str + :param parameters: Request body. Required. + :type parameters: JSON + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SoftwareUpdateConfiguration. The SoftwareUpdateConfiguration is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_name: str, + parameters: IO[bytes], + *, + client_request_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SoftwareUpdateConfiguration: + """Create a new software update configuration with the name given in the URI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_name: The name of the software update configuration to be + created. Required. + :type software_update_configuration_name: str + :param parameters: Request body. Required. + :type parameters: IO[bytes] + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SoftwareUpdateConfiguration. The SoftwareUpdateConfiguration is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_name: str, + parameters: Union[_models.SoftwareUpdateConfiguration, JSON, IO[bytes]], + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfiguration: + """Create a new software update configuration with the name given in the URI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_name: The name of the software update configuration to be + created. Required. + :type software_update_configuration_name: str + :param parameters: Request body. Is one of the following types: SoftwareUpdateConfiguration, + JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration or JSON or + IO[bytes] + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: SoftwareUpdateConfiguration. The SoftwareUpdateConfiguration is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_software_update_configurations_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + software_update_configuration_name=software_update_configuration_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """delete a specific software update configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_name: The name of the software update configuration to be + created. Required. + :type software_update_configuration_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_software_update_configurations_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + software_update_configuration_name=software_update_configuration_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + automation_account_name: str, + *, + client_request_id: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfigurationListResult: + """Get all software update configurations for the account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: SoftwareUpdateConfigurationListResult. The SoftwareUpdateConfigurationListResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftwareUpdateConfigurationListResult] = kwargs.pop("cls", None) + + _request = build_software_update_configurations_list_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfigurationListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_id: str, + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Retrieve a hybrid runbook worker. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The HybridRunbookWorker is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) + + _request = build_hybrid_runbook_workers_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridRunbookWorker, response.json()) + + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The HybridRunbookWorker is compatible with MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Create a hybrid runbook worker. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridRunbookWorker. The HybridRunbookWorker is compatible with MutableMapping + :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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The HybridRunbookWorker is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Create a hybrid runbook worker. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 one of the following types: HybridRunbookWorkerCreateParameters, JSON, + IO[bytes] Required. + :type hybrid_runbook_worker_creation_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters or JSON or IO[bytes] + :return: HybridRunbookWorker. The HybridRunbookWorker is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(hybrid_runbook_worker_creation_parameters, (IOBase, bytes)): + _content = hybrid_runbook_worker_creation_parameters + else: + _content = json.dumps(hybrid_runbook_worker_creation_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hybrid_runbook_workers_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridRunbookWorker, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def patch( + 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: Optional[_models.HybridRunbookWorkerCreateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. Default value is None. + :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. The HybridRunbookWorker is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch( + 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: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. Default value is None. + :type hybrid_runbook_worker_creation_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridRunbookWorker. The HybridRunbookWorker is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch( + 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: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. Default value is None. + :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. The HybridRunbookWorker is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def patch( + 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: Optional[ + Union[_models.HybridRunbookWorkerCreateParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> _models.HybridRunbookWorker: + """Update a hybrid runbook worker. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 one of the following types: HybridRunbookWorkerCreateParameters, JSON, + IO[bytes] Default value is None. + :type hybrid_runbook_worker_creation_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters or JSON or IO[bytes] + :return: HybridRunbookWorker. The HybridRunbookWorker is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorker + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if hybrid_runbook_worker_creation_parameters else None + cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if hybrid_runbook_worker_creation_parameters else None + _content = None + if isinstance(hybrid_runbook_worker_creation_parameters, (IOBase, bytes)): + _content = hybrid_runbook_worker_creation_parameters + else: + if hybrid_runbook_worker_creation_parameters is not None: + _content = json.dumps(hybrid_runbook_worker_creation_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_hybrid_runbook_workers_patch_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridRunbookWorker, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_hybrid_runbook_workers_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = 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 = _failsafe_deserialize( + _models.ErrorResponse, + 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 + ) -> ItemPaged["_models.HybridRunbookWorker"]: + """Retrieve a list of hybrid runbook workers. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. + :type hybrid_runbook_worker_group_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of HybridRunbookWorker + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.HybridRunbookWorker] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.HybridRunbookWorker]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_hybrid_runbook_workers_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.HybridRunbookWorker], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def move( + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def move( + 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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Move a hybrid worker to a different group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def move( + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> None: + """Move a hybrid worker to a different group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 one + of the following types: HybridRunbookWorkerMoveParameters, JSON, IO[bytes] Required. + :type hybrid_runbook_worker_move_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerMoveParameters or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(hybrid_runbook_worker_move_parameters, (IOBase, bytes)): + _content = hybrid_runbook_worker_move_parameters + else: + _content = json.dumps(hybrid_runbook_worker_move_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hybrid_runbook_workers_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class Python2PackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`python2_package` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, package_name: str, **kwargs: Any + ) -> _models.Module: + """Retrieve the python 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Module] = kwargs.pop("cls", None) + + _request = build_python2_package_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + 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 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the python 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The create or update parameters for python package. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :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 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Module: + """Create or Update the python 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The create or update parameters for python package. Is one of the following + types: PythonPackageCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or JSON or + IO[bytes] + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_python2_package_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + 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 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the python 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The update parameters for python package. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :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 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Module: + """Update the python 2 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The update parameters for python package. Is one of the following types: + PythonPackageUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or JSON or + IO[bytes] + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_python2_package_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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 2 package by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_python2_package_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.Module"]: + """Retrieve a list of python 2 packages. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Module + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Module] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Module]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_python2_package_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Module], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, package_name: str, **kwargs: Any + ) -> _models.Module: + """Retrieve the python 3 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Module] = kwargs.pop("cls", None) + + _request = build_python3_package_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the python 3 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The create or update parameters for python package. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Module: + """Create or Update the python 3 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The create or update parameters for python package. Is one of the following + types: PythonPackageCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or JSON or + IO[bytes] + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_python3_package_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the python 3 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The update parameters for python package. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. 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. The Module is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Module: + """Update the python 3 package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :param parameters: The update parameters for python package. Is one of the following types: + PythonPackageUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or JSON or + IO[bytes] + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_python3_package_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param package_name: The python package name. Required. + :type package_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_python3_package_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.Module"]: + """Retrieve a list of python 3 packages. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Module + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Module] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Module]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_python3_package_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Module], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RuntimeEnvironmentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`runtime_environments` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, runtime_environment_name: str, **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Get information about the Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RuntimeEnvironment] = kwargs.pop("cls", None) + + _request = build_runtime_environments_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RuntimeEnvironment, response.json()) + + 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, + runtime_environment_name: str, + parameters: _models.RuntimeEnvironment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. 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: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: Union[_models.RuntimeEnvironment, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Create or update Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the create the runtime environment. Is one of the + following types: RuntimeEnvironment, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironment or JSON or IO[bytes] + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RuntimeEnvironment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_runtime_environments_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RuntimeEnvironment, response.json()) + + 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, + runtime_environment_name: str, + parameters: _models.RuntimeEnvironmentUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironmentUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. 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: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + parameters: Union[_models.RuntimeEnvironmentUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.RuntimeEnvironment: + """Update an Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param parameters: Parameters supplied to the Runtime Environment. Is one of the following + types: RuntimeEnvironmentUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.RuntimeEnvironmentUpdateParameters or JSON or + IO[bytes] + :return: RuntimeEnvironment. The RuntimeEnvironment is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RuntimeEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RuntimeEnvironment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_runtime_environments_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RuntimeEnvironment, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, runtime_environment_name: str, **kwargs: Any + ) -> None: + """Delete the Runtime Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_runtime_environments_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.RuntimeEnvironment"]: + """Retrieve a list of RuntimeEnvironments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of RuntimeEnvironment + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.RuntimeEnvironment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RuntimeEnvironment]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_runtime_environments_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RuntimeEnvironment], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param 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. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + 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, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :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: JSON, + *, + 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Required. + :type parameters: JSON + :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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Is one of the following types: PrivateEndpointConnection, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.automation.models.PrivateEndpointConnection or JSON or IO[bytes] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: 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, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateEndpointConnection"]: + """List all private endpoint connections on a Automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateEndpointConnection], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class AutomationAccountOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`automation_account` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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.AutomationAccount: + """Get information about an Automation Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) + + _request = build_automation_account_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AutomationAccount, response.json()) + + 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, + parameters: _models.AutomationAccountCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutomationAccount: + """Create or update automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the create or update automation account. Required. + :type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutomationAccount: + """Create or update automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the create or update automation account. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutomationAccount: + """Create or update automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the create or update automation account. 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: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + parameters: Union[_models.AutomationAccountCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AutomationAccount: + """Create or update automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the create or update automation account. Is one of + the following types: AutomationAccountCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters or + JSON or IO[bytes] + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_automation_account_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AutomationAccount, response.json()) + + 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, + parameters: _models.AutomationAccountUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutomationAccount: + """Update an automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the update automation account. Required. + :type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutomationAccount: + """Update an automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the update automation account. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutomationAccount: + """Update an automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the update automation account. 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: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + parameters: Union[_models.AutomationAccountUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AutomationAccount: + """Update an automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Parameters supplied to the update automation account. Is one of the + following types: AutomationAccountUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters or JSON or + IO[bytes] + :return: AutomationAccount. The AutomationAccount is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AutomationAccount + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_automation_account_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AutomationAccount, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> None: + """Delete an automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_automation_account_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of AutomationAccount + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.AutomationAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutomationAccount]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_account_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.AutomationAccount], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + 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. + + :return: An iterator like instance of AutomationAccount + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.AutomationAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AutomationAccount]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_account_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.AutomationAccount], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_deleted_runbooks( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.DeletedRunbook"]: + """Retrieve the deleted runbooks for an automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of DeletedRunbook + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.DeletedRunbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeletedRunbook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_account_list_deleted_runbooks_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DeletedRunbook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class NodeCountInformationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`node_count_information` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, + count_type: Union[str, _models.CountType], + **kwargs: Any + ) -> _models.NodeCounts: + """Retrieve counts for Dsc Nodes. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param count_type: The type of counts to retrieve. Known values are: "status" and + "nodeconfiguration". Required. + :type count_type: str or ~azure.mgmt.automation.models.CountType + :return: NodeCounts. The NodeCounts is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.NodeCounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NodeCounts] = kwargs.pop("cls", None) + + _request = build_node_count_information_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + count_type=count_type, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NodeCounts, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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 automation( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateLinkResource"]: + """Gets the private link resources that need to be created for Automation account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_link_resources_automation_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateLinkResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class AgentRegistrationInformationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`agent_registration_information` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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: + """Retrieve the automation agent registration information. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: AgentRegistration. The AgentRegistration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AgentRegistration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) + + _request = build_agent_registration_information_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentRegistration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def regenerate_key( + self, + resource_group_name: str, + automation_account_name: str, + parameters: _models.AgentRegistrationRegenerateKeyParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AgentRegistration: + """Regenerate a primary or secondary agent registration key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: The name of the agent registration key to be regenerated. Required. + :type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AgentRegistration. The AgentRegistration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AgentRegistration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_key( + self, + resource_group_name: str, + automation_account_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AgentRegistration: + """Regenerate a primary or secondary agent registration key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: The name of the agent registration key to be regenerated. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AgentRegistration. The AgentRegistration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AgentRegistration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_key( + self, + resource_group_name: str, + automation_account_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AgentRegistration: + """Regenerate a primary or secondary agent registration key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: The name of the agent registration key to be regenerated. 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: AgentRegistration. The AgentRegistration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AgentRegistration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_key( + self, + resource_group_name: str, + automation_account_name: str, + parameters: Union[_models.AgentRegistrationRegenerateKeyParameter, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AgentRegistration: + """Regenerate a primary or secondary agent registration key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: The name of the agent registration key to be regenerated. Is one of the + following types: AgentRegistrationRegenerateKeyParameter, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter or JSON + or IO[bytes] + :return: AgentRegistration. The AgentRegistration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.AgentRegistration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_agent_registration_information_regenerate_key_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentRegistration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class StatisticsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`statistics` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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 + ) -> ItemPaged["_models.Statistics"]: + """Retrieve the statistics for the account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of Statistics + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Statistics] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Statistics]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_statistics_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Statistics], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class UsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`usages` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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 + ) -> ItemPaged["_models.Usage"]: + """Retrieve the usage for the account id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Usage + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Usage]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_usages_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Usage], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class KeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`keys` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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 + ) -> _models.KeyListResult: + """Retrieve the automation keys for an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: KeyListResult. The KeyListResult is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.KeyListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) + + _request = build_keys_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.KeyListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class JobOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`job` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.JobCollectionItem"]: + """Retrieve a list of jobs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: An iterator like instance of JobCollectionItem + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.JobCollectionItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.JobCollectionItem]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_job_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.JobCollectionItem], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.Job: + """Retrieve the job identified by job name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: Job. The Job is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + + _request = build_job_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Job, response.json()) + + 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, + job_name: str, + parameters: _models.JobCreateParameters, + *, + client_request_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Job: + """Create a job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :param parameters: The parameters supplied to the create job operation. Required. + :type parameters: ~azure.mgmt.automation.models.JobCreateParameters + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Job. The Job is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + parameters: JSON, + *, + client_request_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Job: + """Create a job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :param parameters: The parameters supplied to the create job operation. Required. + :type parameters: JSON + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Job. The Job is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + parameters: IO[bytes], + *, + client_request_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Job: + """Create a job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :param parameters: The parameters supplied to the create job operation. Required. + :type parameters: IO[bytes] + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Job. The Job is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + parameters: Union[_models.JobCreateParameters, JSON, IO[bytes]], + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.Job: + """Create a job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :param parameters: The parameters supplied to the create job operation. Is one of the following + types: JobCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.JobCreateParameters or JSON or IO[bytes] + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: Job. The Job is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_job_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Job, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_output( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> str: + """Retrieve the job output identified by job name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_job_get_output_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_runbook_content( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> str: + """Retrieve the runbook content of the job identified by job name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_job_get_runbook_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def suspend( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """Suspend the job identified by job name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_job_suspend_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def stop( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """Stop the job identified by jobName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_job_stop_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def resume( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """Resume the job identified by jobName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_job_resume_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class LinkedWorkspaceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`linked_workspace` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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: + """Retrieve the linked workspace for the account id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: LinkedWorkspace. The LinkedWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.LinkedWorkspace + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.LinkedWorkspace] = kwargs.pop("cls", None) + + _request = build_linked_workspace_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LinkedWorkspace, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ObjectDataTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`object_data_types` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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_type( + self, resource_group_name: str, automation_account_name: str, type_name: str, **kwargs: Any + ) -> ItemPaged["_models.TypeField"]: + """Retrieve a list of fields of a given type across all accessible modules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param type_name: The name of type. Required. + :type type_name: str + :return: An iterator like instance of TypeField + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.TypeField] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TypeField]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_object_data_types_list_fields_by_type_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + type_name=type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.TypeField], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @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 + ) -> ItemPaged["_models.TypeField"]: + """Retrieve a list of fields of a given type identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param type_name: The name of type. Required. + :type type_name: str + :return: An iterator like instance of TypeField + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.TypeField] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TypeField]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_object_data_types_list_fields_by_module_and_type_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + type_name=type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.TypeField], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SoftwareUpdateConfigurationMachineRunsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`software_update_configuration_machine_runs` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_machine_run_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfigurationMachineRun: + """Get a single software update configuration machine run by Id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_machine_run_id: The Id of the software update + configuration machine run. Required. + :type software_update_configuration_machine_run_id: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: SoftwareUpdateConfigurationMachineRun. The SoftwareUpdateConfigurationMachineRun is + compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftwareUpdateConfigurationMachineRun] = kwargs.pop("cls", None) + + _request = build_software_update_configuration_machine_runs_get_by_id_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + software_update_configuration_machine_run_id=software_update_configuration_machine_run_id, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfigurationMachineRun, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + automation_account_name: str, + *, + client_request_id: Optional[str] = None, + filter: Optional[str] = None, + skip: Optional[str] = None, + top: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfigurationMachineRunListResult: + """Return list of software update configuration machine runs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword filter: The filter to apply on the operation. You can use the following filters: + 'properties/osType', 'properties/status', 'properties/startTime', and + 'properties/softwareUpdateConfiguration/name'. Default value is None. + :paramtype filter: str + :keyword skip: number of entries you skip before returning results. Default value is None. + :paramtype skip: str + :keyword top: Maximum number of entries returned in the results collection. Default value is + None. + :paramtype top: str + :return: SoftwareUpdateConfigurationMachineRunListResult. The + SoftwareUpdateConfigurationMachineRunListResult is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRunListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftwareUpdateConfigurationMachineRunListResult] = kwargs.pop("cls", None) + + _request = build_software_update_configuration_machine_runs_list_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + filter=filter, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfigurationMachineRunListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class SoftwareUpdateConfigurationRunsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`software_update_configuration_runs` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + software_update_configuration_run_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfigurationRun: + """Get a single software update configuration Run by Id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param software_update_configuration_run_id: The Id of the software update configuration run. + Required. + :type software_update_configuration_run_id: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: SoftwareUpdateConfigurationRun. The SoftwareUpdateConfigurationRun is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftwareUpdateConfigurationRun] = kwargs.pop("cls", None) + + _request = build_software_update_configuration_runs_get_by_id_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + software_update_configuration_run_id=software_update_configuration_run_id, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfigurationRun, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + automation_account_name: str, + *, + client_request_id: Optional[str] = None, + filter: Optional[str] = None, + skip: Optional[str] = None, + top: Optional[str] = None, + **kwargs: Any + ) -> _models.SoftwareUpdateConfigurationRunListResult: + """Return list of software update configuration runs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :keyword filter: The filter to apply on the operation. You can use the following filters: + 'properties/osType', 'properties/status', 'properties/startTime', and + 'properties/softwareUpdateConfiguration/name'. Default value is None. + :paramtype filter: str + :keyword skip: Number of entries you skip before returning results. Default value is None. + :paramtype skip: str + :keyword top: Maximum number of entries returned in the results collection. Default value is + None. + :paramtype top: str + :return: SoftwareUpdateConfigurationRunListResult. The SoftwareUpdateConfigurationRunListResult + is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftwareUpdateConfigurationRunListResult] = kwargs.pop("cls", None) + + _request = build_software_update_configuration_runs_list_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + filter=filter, + skip=skip, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftwareUpdateConfigurationRunListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class WebhookOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`webhook` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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: + """Generates a Uri for use in creating a webhook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_webhook_generate_uri_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, automation_account_name: str, webhook_name: str, **kwargs: Any + ) -> _models.Webhook: + """Retrieve the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) + + _request = build_webhook_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Webhook, response.json()) + + 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, + webhook_name: str, + parameters: _models.WebhookCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Webhook: + """Create the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The create or update parameters for webhook. Required. + :type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + webhook_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Webhook: + """Create the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The create or update parameters for webhook. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + webhook_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Webhook: + """Create the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The create or update parameters for webhook. 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: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + webhook_name: str, + parameters: Union[_models.WebhookCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Webhook: + """Create the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The create or update parameters for webhook. Is one of the following types: + WebhookCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_webhook_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Webhook, response.json()) + + 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, + webhook_name: str, + parameters: _models.WebhookUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Webhook: + """Update the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The update parameters for webhook. Required. + :type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + webhook_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Webhook: + """Update the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The update parameters for webhook. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + webhook_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Webhook: + """Update the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The update parameters for webhook. 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: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + webhook_name: str, + parameters: Union[_models.WebhookUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Webhook: + """Update the webhook identified by webhook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :param parameters: The update parameters for webhook. Is one of the following types: + WebhookUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters or JSON or IO[bytes] + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_webhook_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Webhook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, webhook_name: str, **kwargs: Any + ) -> None: + """Delete the webhook by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param webhook_name: The webhook name. Required. + :type webhook_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_webhook_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.Webhook"]: + """Retrieve a list of webhooks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of Webhook + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Webhook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_webhook_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Webhook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DscNodeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`dsc_node` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, node_id: str, **kwargs: Any + ) -> _models.DscNode: + """Retrieve the dsc node identified by node id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :return: DscNode. The DscNode is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) + + _request = build_dsc_node_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_id=node_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscNode, response.json()) + + 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, + node_id: str, + dsc_node_update_parameters: _models.DscNodeUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscNode: + """Update the dsc node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Required. + :type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DscNode. The DscNode is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + node_id: str, + dsc_node_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscNode: + """Update the dsc node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Required. + :type dsc_node_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DscNode. The DscNode is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + node_id: str, + dsc_node_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscNode: + """Update the dsc node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Required. + :type dsc_node_update_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: DscNode. The DscNode is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + node_id: str, + dsc_node_update_parameters: Union[_models.DscNodeUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.DscNode: + """Update the dsc node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Is one of the + following types: DscNodeUpdateParameters, JSON, IO[bytes] Required. + :type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters or JSON + or IO[bytes] + :return: DscNode. The DscNode is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(dsc_node_update_parameters, (IOBase, bytes)): + _content = dsc_node_update_parameters + else: + _content = json.dumps(dsc_node_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dsc_node_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_id=node_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscNode, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, node_id: str, **kwargs: Any + ) -> None: + """Delete the dsc node identified by node id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_dsc_node_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_id=node_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, + resource_group_name: str, + automation_account_name: str, + *, + filter: Optional[str] = None, + skip: Optional[int] = None, + top: Optional[int] = None, + inlinecount: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.DscNode"]: + """Retrieve a list of dsc nodes. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword skip: The number of rows to skip. Default value is None. + :paramtype skip: int + :keyword top: The number of rows to take. Default value is None. + :paramtype top: int + :keyword inlinecount: Return total rows. Default value is None. + :paramtype inlinecount: str + :return: An iterator like instance of DscNode + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.DscNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DscNode]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dsc_node_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + skip=skip, + top=top, + inlinecount=inlinecount, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DscNode], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class NodeReportsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`node_reports` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + node_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.DscNodeReport"]: + """Retrieve the Dsc node report list by node id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of DscNodeReport + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.DscNodeReport] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DscNodeReport]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_node_reports_list_by_node_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_id=node_id, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DscNodeReport], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, automation_account_name: str, node_id: str, report_id: str, **kwargs: Any + ) -> _models.DscNodeReport: + """Retrieve the Dsc node report data by node id and report id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :param report_id: The report id. Required. + :type report_id: str + :return: DscNodeReport. The DscNodeReport is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNodeReport + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DscNodeReport] = kwargs.pop("cls", None) + + _request = build_node_reports_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_id=node_id, + report_id=report_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscNodeReport, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_content( + self, resource_group_name: str, automation_account_name: str, node_id: str, report_id: str, **kwargs: Any + ) -> str: + """Retrieve the Dsc node reports by node id and report id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_id: The node id. Required. + :type node_id: str + :param report_id: The report id. Required. + :type report_id: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_node_reports_get_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_id=node_id, + report_id=report_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class CertificateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`certificate` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, certificate_name: str, **kwargs: Any + ) -> _models.Certificate: + """Retrieve the certificate identified by certificate name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + + _request = build_certificate_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Certificate, response.json()) + + 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, + certificate_name: str, + parameters: _models.CertificateCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Certificate: + """Create a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the create or update certificate operation. + Required. + :type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + certificate_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Certificate: + """Create a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the create or update certificate operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + certificate_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Certificate: + """Create a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the create or update certificate operation. + 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: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + certificate_name: str, + parameters: Union[_models.CertificateCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Certificate: + """Create a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the create or update certificate operation. Is + one of the following types: CertificateCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_certificate_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Certificate, response.json()) + + 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, + certificate_name: str, + parameters: _models.CertificateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Certificate: + """Update a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the update certificate operation. Required. + :type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + certificate_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Certificate: + """Update a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the update certificate operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + certificate_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Certificate: + """Update a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the update certificate operation. 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: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + certificate_name: str, + parameters: Union[_models.CertificateUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Certificate: + """Update a certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :param parameters: The parameters supplied to the update certificate operation. Is one of the + following types: CertificateUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters or JSON or + IO[bytes] + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_certificate_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Certificate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, certificate_name: str, **kwargs: Any + ) -> None: + """Delete the certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param certificate_name: The name of certificate. Required. + :type certificate_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_certificate_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.Certificate"]: + """Retrieve a list of certificates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Certificate + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Certificate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Certificate]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_certificate_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Certificate], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`connection` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, connection_name: str, **kwargs: Any + ) -> _models.Connection: + """Retrieve the connection identified by connection name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + + _request = build_connection_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Connection, response.json()) + + 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, + connection_name: str, + parameters: _models.ConnectionCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Connection: + """Create or update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the create or update connection operation. + Required. + :type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + connection_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Connection: + """Create or update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the create or update connection operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Connection: + """Create or update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the create or update connection operation. + 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: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + connection_name: str, + parameters: Union[_models.ConnectionCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Connection: + """Create or update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the create or update connection operation. Is one + of the following types: ConnectionCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connection_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Connection, response.json()) + + 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, + connection_name: str, + parameters: _models.ConnectionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Connection: + """Update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the update a connection operation. Required. + :type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + connection_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Connection: + """Update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the update a connection operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Connection: + """Update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the update a connection operation. 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: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + connection_name: str, + parameters: Union[_models.ConnectionUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Connection: + """Update a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :param parameters: The parameters supplied to the update a connection operation. Is one of the + following types: ConnectionUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters or JSON or IO[bytes] + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Connection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connection_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Connection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, connection_name: str, **kwargs: Any + ) -> None: + """Delete the connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_name: The name of connection. Required. + :type connection_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_connection_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.Connection"]: + """Retrieve a list of connections. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Connection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Connection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_connection_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Connection], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ConnectionTypeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`connection_type` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, connection_type_name: str, **kwargs: Any + ) -> _models.ConnectionType: + """Retrieve the connection type identified by connection type name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_type_name: The name of connection type. Required. + :type connection_type_name: str + :return: ConnectionType. The ConnectionType is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.ConnectionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) + + _request = build_connection_type_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_type_name=connection_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ConnectionType, response.json()) + + 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, + connection_type_name: str, + parameters: _models.ConnectionTypeCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionType: + """Create a connection type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_type_name: The name of connection type. Required. + :type connection_type_name: str + :param parameters: The parameters supplied to the create or update connection type operation. + Required. + :type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionType. The ConnectionType is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.ConnectionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + connection_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionType: + """Create a connection type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_type_name: The name of connection type. Required. + :type connection_type_name: str + :param parameters: The parameters supplied to the create or update connection type operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionType. The ConnectionType is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.ConnectionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + connection_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionType: + """Create a connection type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_type_name: The name of connection type. Required. + :type connection_type_name: str + :param parameters: The parameters supplied to the create or update connection type operation. + 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: ConnectionType. The ConnectionType is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.ConnectionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + connection_type_name: str, + parameters: Union[_models.ConnectionTypeCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ConnectionType: + """Create a connection type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_type_name: The name of connection type. Required. + :type connection_type_name: str + :param parameters: The parameters supplied to the create or update connection type operation. + Is one of the following types: ConnectionTypeCreateOrUpdateParameters, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters or JSON + or IO[bytes] + :return: ConnectionType. The ConnectionType is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.ConnectionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connection_type_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_type_name=connection_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ConnectionType, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, connection_type_name: str, **kwargs: Any + ) -> None: + """Delete the connection type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param connection_type_name: The name of connection type. Required. + :type connection_type_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_connection_type_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + connection_type_name=connection_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.ConnectionType"]: + """Retrieve a list of connection types. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of ConnectionType + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.ConnectionType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ConnectionType]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_connection_type_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ConnectionType], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CredentialOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`credential` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, credential_name: str, **kwargs: Any + ) -> _models.Credential: + """Retrieve the credential identified by credential name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Credential] = kwargs.pop("cls", None) + + _request = build_credential_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + credential_name=credential_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Credential, response.json()) + + 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, + credential_name: str, + parameters: _models.CredentialCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Credential: + """Create a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the create or update credential operation. + Required. + :type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + credential_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Credential: + """Create a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the create or update credential operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + credential_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Credential: + """Create a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the create or update credential operation. + 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: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + credential_name: str, + parameters: Union[_models.CredentialCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Credential: + """Create a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the create or update credential operation. Is one + of the following types: CredentialCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Credential] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_credential_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + credential_name=credential_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Credential, response.json()) + + 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, + credential_name: str, + parameters: _models.CredentialUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Credential: + """Update a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the Update credential operation. Required. + :type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + credential_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Credential: + """Update a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the Update credential operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + credential_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Credential: + """Update a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the Update credential operation. 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: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + credential_name: str, + parameters: Union[_models.CredentialUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Credential: + """Update a credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :param parameters: The parameters supplied to the Update credential operation. Is one of the + following types: CredentialUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters or JSON or IO[bytes] + :return: Credential. The Credential is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Credential + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Credential] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_credential_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + credential_name=credential_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Credential, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, credential_name: str, **kwargs: Any + ) -> None: + """Delete the credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param credential_name: The name of credential. Required. + :type credential_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_credential_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + credential_name=credential_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.Credential"]: + """Retrieve a list of credentials. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Credential + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Credential] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Credential]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_credential_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Credential], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DscConfigurationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`dsc_configuration` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, configuration_name: str, **kwargs: Any + ) -> _models.DscConfiguration: + """Retrieve the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) + + _request = build_dsc_configuration_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscConfiguration, response.json()) + + 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, + configuration_name: str, + parameters: _models.DscConfigurationCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Required. + :type parameters: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + configuration_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + configuration_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. 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: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + configuration_name: str, + parameters: Union[_models.DscConfigurationCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Is one of the following + types: DscConfigurationCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters or + JSON or IO[bytes] + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dsc_configuration_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscConfiguration, response.json()) + + 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, + configuration_name: str, + parameters: Optional[_models.DscConfigurationUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Default value is None. + :type parameters: ~azure.mgmt.automation.models.DscConfigurationUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + configuration_name: str, + parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Default value is None. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + configuration_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Default value is None. + :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: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + configuration_name: str, + parameters: Optional[Union[_models.DscConfigurationUpdateParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DscConfiguration: + """Create the configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. Is one of the following + types: DscConfigurationUpdateParameters, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.automation.models.DscConfigurationUpdateParameters or JSON or + IO[bytes] + :return: DscConfiguration. The DscConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_dsc_configuration_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, configuration_name: str, **kwargs: Any + ) -> None: + """Delete the dsc configuration identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_dsc_configuration_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, + resource_group_name: str, + automation_account_name: str, + *, + filter: Optional[str] = None, + skip: Optional[int] = None, + top: Optional[int] = None, + inlinecount: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.DscConfiguration"]: + """Retrieve a list of configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword skip: The number of rows to skip. Default value is None. + :paramtype skip: int + :keyword top: The number of rows to take. Default value is None. + :paramtype top: int + :keyword inlinecount: Return total rows. Default value is None. + :paramtype inlinecount: str + :return: An iterator like instance of DscConfiguration + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.DscConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DscConfiguration]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dsc_configuration_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + skip=skip, + top=top, + inlinecount=inlinecount, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DscConfiguration], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_content( + self, resource_group_name: str, automation_account_name: str, configuration_name: str, **kwargs: Any + ) -> str: + """Retrieve the configuration script identified by configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param configuration_name: The configuration name. Required. + :type configuration_name: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_dsc_configuration_get_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class DscNodeConfigurationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`dsc_node_configuration` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, node_configuration_name: str, **kwargs: Any + ) -> _models.DscNodeConfiguration: + """Retrieve the Dsc node configurations by node configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_configuration_name: The Dsc node configuration name. Required. + :type node_configuration_name: str + :return: DscNodeConfiguration. The DscNodeConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DscNodeConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DscNodeConfiguration] = kwargs.pop("cls", None) + + _request = build_dsc_node_configuration_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_configuration_name=node_configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DscNodeConfiguration, response.json()) + + 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, + node_configuration_name: str, + parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dsc_node_configuration_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_configuration_name=node_configuration_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + node_configuration_name: str, + parameters: _models.DscNodeConfigurationCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DscNodeConfiguration]: + """Create the node configuration identified by node configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_configuration_name: The Dsc node configuration name. Required. + :type node_configuration_name: str + :param parameters: The create or update parameters for configuration. Required. + :type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters + :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 DscNodeConfiguration. The DscNodeConfiguration + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + node_configuration_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DscNodeConfiguration]: + """Create the node configuration identified by node configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_configuration_name: The Dsc node configuration name. Required. + :type node_configuration_name: str + :param parameters: The create or update parameters for configuration. Required. + :type parameters: JSON + :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 DscNodeConfiguration. The DscNodeConfiguration + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + node_configuration_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DscNodeConfiguration]: + """Create the node configuration identified by node configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_configuration_name: The Dsc node configuration name. Required. + :type node_configuration_name: str + :param parameters: The create or update parameters for configuration. 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 DscNodeConfiguration. The DscNodeConfiguration + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + node_configuration_name: str, + parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DscNodeConfiguration]: + """Create the node configuration identified by node configuration name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_configuration_name: The Dsc node configuration name. Required. + :type node_configuration_name: str + :param parameters: The create or update parameters for configuration. Is one of the following + types: DscNodeConfigurationCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters or + JSON or IO[bytes] + :return: An instance of LROPoller that returns DscNodeConfiguration. The DscNodeConfiguration + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.automation.models.DscNodeConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DscNodeConfiguration] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.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, + node_configuration_name=node_configuration_name, + parameters=parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DscNodeConfiguration, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DscNodeConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DscNodeConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, node_configuration_name: str, **kwargs: Any + ) -> None: + """Delete the Dsc node configurations by node configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param node_configuration_name: The Dsc node configuration name. Required. + :type node_configuration_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_dsc_node_configuration_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + node_configuration_name=node_configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, + resource_group_name: str, + automation_account_name: str, + *, + filter: Optional[str] = None, + skip: Optional[int] = None, + top: Optional[int] = None, + inlinecount: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.DscNodeConfiguration"]: + """Retrieve a list of dsc node configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword skip: The number of rows to skip. Default value is None. + :paramtype skip: int + :keyword top: The number of rows to take. Default value is None. + :paramtype top: int + :keyword inlinecount: Return total rows. Default value is None. + :paramtype inlinecount: str + :return: An iterator like instance of DscNodeConfiguration + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.DscNodeConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DscNodeConfiguration]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dsc_node_configuration_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + skip=skip, + top=top, + inlinecount=inlinecount, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DscNodeConfiguration], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class HybridRunbookWorkerGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`hybrid_runbook_worker_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, + hybrid_runbook_worker_group_name: str, + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Retrieve a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. + :type hybrid_runbook_worker_group_name: str + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) + + _request = build_hybrid_runbook_worker_group_get_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridRunbookWorkerGroup, response.json()) + + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Create a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :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, JSON, IO[bytes] + ], + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Create a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 one of the following types: + HybridRunbookWorkerGroupCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type hybrid_runbook_worker_group_creation_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or JSON or + IO[bytes] + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(hybrid_runbook_worker_group_creation_parameters, (IOBase, bytes)): + _content = hybrid_runbook_worker_group_creation_parameters + else: + _content = json.dumps(hybrid_runbook_worker_group_creation_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hybrid_runbook_worker_group_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridRunbookWorkerGroup, response.json()) + + 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, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_group_updation_parameters: _models.HybridRunbookWorkerGroupCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Update a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_group_updation_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Update a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_group_updation_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Update a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + hybrid_runbook_worker_group_updation_parameters: Union[ + _models.HybridRunbookWorkerGroupCreateOrUpdateParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> _models.HybridRunbookWorkerGroup: + """Update a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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 one + of the following types: HybridRunbookWorkerGroupCreateOrUpdateParameters, JSON, IO[bytes] + Required. + :type hybrid_runbook_worker_group_updation_parameters: + ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or JSON or + IO[bytes] + :return: HybridRunbookWorkerGroup. The HybridRunbookWorkerGroup is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(hybrid_runbook_worker_group_updation_parameters, (IOBase, bytes)): + _content = hybrid_runbook_worker_group_updation_parameters + else: + _content = json.dumps(hybrid_runbook_worker_group_updation_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hybrid_runbook_worker_group_update_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridRunbookWorkerGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + automation_account_name: str, + hybrid_runbook_worker_group_name: str, + **kwargs: Any + ) -> None: + """Delete a hybrid runbook worker group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. + :type hybrid_runbook_worker_group_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_hybrid_runbook_worker_group_delete_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.HybridRunbookWorkerGroup"]: + """Retrieve a list of hybrid runbook worker groups. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of HybridRunbookWorkerGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.HybridRunbookWorkerGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.HybridRunbookWorkerGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_hybrid_runbook_worker_group_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.HybridRunbookWorkerGroup], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class JobStreamOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`job_stream` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, + job_name: str, + job_stream_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> _models.JobStream: + """Retrieve the job stream identified by job stream id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :param job_stream_id: The job stream id. Required. + :type job_stream_id: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: JobStream. The JobStream is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobStream + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) + + _request = build_job_stream_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + job_stream_id=job_stream_id, + subscription_id=self._config.subscription_id, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.JobStream, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_job( + self, + resource_group_name: str, + automation_account_name: str, + job_name: str, + *, + filter: Optional[str] = None, + client_request_id: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.JobStream"]: + """Retrieve a list of jobs streams identified by job name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword client_request_id: Identifies this specific client request. Default value is None. + :paramtype client_request_id: str + :return: An iterator like instance of JobStream + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.JobStream] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.JobStream]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_job_stream_list_by_job_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + filter=filter, + client_request_id=client_request_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.JobStream], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class JobScheduleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`job_schedule` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, job_schedule_id: str, **kwargs: Any + ) -> _models.JobSchedule: + """Retrieve the job schedule identified by job schedule name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_schedule_id: The job schedule name. Required. + :type job_schedule_id: str + :return: JobSchedule. The JobSchedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) + + _request = build_job_schedule_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_schedule_id=job_schedule_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.JobSchedule, response.json()) + + 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, + job_schedule_id: str, + parameters: _models.JobScheduleCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.JobSchedule: + """Create a job schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_schedule_id: The job schedule name. Required. + :type job_schedule_id: str + :param parameters: The parameters supplied to the create job schedule operation. Required. + :type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JobSchedule. The JobSchedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + job_schedule_id: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.JobSchedule: + """Create a job schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_schedule_id: The job schedule name. Required. + :type job_schedule_id: str + :param parameters: The parameters supplied to the create job schedule operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JobSchedule. The JobSchedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + job_schedule_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.JobSchedule: + """Create a job schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_schedule_id: The job schedule name. Required. + :type job_schedule_id: str + :param parameters: The parameters supplied to the create job schedule operation. 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: JobSchedule. The JobSchedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + automation_account_name: str, + job_schedule_id: str, + parameters: Union[_models.JobScheduleCreateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.JobSchedule: + """Create a job schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_schedule_id: The job schedule name. Required. + :type job_schedule_id: str + :param parameters: The parameters supplied to the create job schedule operation. Is one of the + following types: JobScheduleCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters or JSON or + IO[bytes] + :return: JobSchedule. The JobSchedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_job_schedule_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_schedule_id=job_schedule_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.JobSchedule, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param job_schedule_id: The job schedule name. Required. + :type job_schedule_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_job_schedule_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + job_schedule_id=job_schedule_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.JobSchedule"]: + """Retrieve a list of job schedules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of JobSchedule + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.JobSchedule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.JobSchedule]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_job_schedule_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.JobSchedule], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ModuleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`module` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, module_name: str, **kwargs: Any + ) -> _models.Module: + """Retrieve the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Module] = kwargs.pop("cls", None) + + _request = build_module_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + 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, + module_name: str, + parameters: _models.ModuleCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The create or update parameters for module. Required. + :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The create or update parameters for module. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The create or update parameters for module. 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. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: Union[_models.ModuleCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The create or update parameters for module. Is one of the following types: + ModuleCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_module_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + 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, + module_name: str, + parameters: _models.ModuleUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The update parameters for module. Required. + :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The update parameters for module. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The update parameters for module. 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. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: Union[_models.ModuleUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param parameters: The update parameters for module. Is one of the following types: + ModuleUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters or JSON or IO[bytes] + :return: Module. The Module is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_module_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Module, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any + ) -> None: + """Delete the module by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_module_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.Module"]: + """Retrieve a list of modules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Module + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Module] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Module]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_module_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Module], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ActivityOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`activity` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, + module_name: str, + activity_name: str, + **kwargs: Any + ) -> _models.Activity: + """Retrieve the activity in the module identified by module name and activity name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param activity_name: The name of activity. Required. + :type activity_name: str + :return: Activity. The Activity is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Activity + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Activity] = kwargs.pop("cls", None) + + _request = build_activity_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + activity_name=activity_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Activity, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_module( + self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any + ) -> ItemPaged["_models.Activity"]: + """Retrieve a list of activities in the module identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :return: An iterator like instance of Activity + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Activity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Activity]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_activity_list_by_module_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Activity], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class FieldsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`fields` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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 + ) -> ItemPaged["_models.TypeField"]: + """Retrieve a list of fields of a given type identified by module name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The module name. Required. + :type module_name: str + :param type_name: The name of type. Required. + :type type_name: str + :return: An iterator like instance of TypeField + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.TypeField] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TypeField]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_fields_list_by_type_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + type_name=type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.TypeField], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`package` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, + runtime_environment_name: str, + package_name: str, + **kwargs: Any + ) -> _models.Package: + """Retrieve the Package identified by Package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Package] = kwargs.pop("cls", None) + + _request = build_package_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Package, response.json()) + + 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, + runtime_environment_name: str, + package_name: str, + parameters: _models.PackageCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The create or update parameters for Package. Required. + :type parameters: ~azure.mgmt.automation.models.PackageCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The create or update parameters for Package. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The create or update parameters for 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: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: Union[_models.PackageCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Package: + """Create or update the package identified by package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The create or update parameters for Package. Is one of the following types: + PackageCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.PackageCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Package] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_package_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Package, response.json()) + + 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, + runtime_environment_name: str, + package_name: str, + parameters: _models.PackageUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The update parameters for Package. Required. + :type parameters: ~azure.mgmt.automation.models.PackageUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The update parameters for Package. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The update parameters for 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: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + parameters: Union[_models.PackageUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Package: + """Update the Package identified by Package name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :param parameters: The update parameters for Package. Is one of the following types: + PackageUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.PackageUpdateParameters or JSON or IO[bytes] + :return: Package. The Package is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Package + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Package] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_package_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Package, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + automation_account_name: str, + runtime_environment_name: str, + package_name: str, + **kwargs: Any + ) -> None: + """Delete the package by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :param package_name: The Package name. Required. + :type package_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_package_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + package_name=package_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_runtime_environment( + self, resource_group_name: str, automation_account_name: str, runtime_environment_name: str, **kwargs: Any + ) -> ItemPaged["_models.Package"]: + """Retrieve the a list of Packages. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runtime_environment_name: The name of the Runtime Environment. Required. + :type runtime_environment_name: str + :return: An iterator like instance of Package + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Package] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Package]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_package_list_by_runtime_environment_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runtime_environment_name=runtime_environment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Package], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RunbookOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`runbook` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, runbook_name: str, **kwargs: Any + ) -> _models.Runbook: + """Retrieve the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) + + _request = build_runbook_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Runbook, response.json()) + + 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, + runbook_name: str, + parameters: _models.RunbookCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Runbook: + """Create the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The create or update parameters for runbook. Provide either content link for + a published runbook or draft, not both. Required. + :type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Runbook: + """Create the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The create or update parameters for runbook. Provide either content link for + a published runbook or draft, not both. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Runbook: + """Create the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The create or update parameters for runbook. Provide either content link for + a published runbook or draft, not both. 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: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: Union[_models.RunbookCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Runbook: + """Create the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The create or update parameters for runbook. Provide either content link for + a published runbook or draft, not both. Is one of the following types: + RunbookCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_runbook_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Runbook, response.json()) + + 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, + runbook_name: str, + parameters: _models.RunbookUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Runbook: + """Update the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The update parameters for runbook. Required. + :type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Runbook: + """Update the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The update parameters for runbook. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Runbook: + """Update the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The update parameters for 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: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: Union[_models.RunbookUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Runbook: + """Update the runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The update parameters for runbook. Is one of the following types: + RunbookUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters or JSON or IO[bytes] + :return: Runbook. The Runbook is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Runbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_runbook_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Runbook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> None: + """Delete the runbook by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_runbook_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.Runbook"]: + """Retrieve a list of runbooks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Runbook + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Runbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Runbook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_runbook_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Runbook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _publish_initial( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_runbook_publish_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_publish( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Publish runbook draft. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._publish_initial( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_content( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> str: + """Retrieve the content of runbook identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_runbook_get_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class RunbookDraftOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`runbook_draft` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> str: + """Retrieve the content of runbook draft identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_runbook_draft_get_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(str, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def _replace_content_initial( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + runbook_content: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "text/plain")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _content = runbook_content + + _request = build_runbook_draft_replace_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_replace_content( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + runbook_content: str, + **kwargs: Any + ) -> LROPoller[None]: + """Replaces the runbook draft content. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param runbook_content: The runbook draft content. Required. + :type runbook_content: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "text/plain")) + cls: 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._replace_content_initial( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + runbook_content=runbook_content, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> _models.RunbookDraft: + """Retrieve the runbook draft identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: RunbookDraft. The RunbookDraft is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.RunbookDraft + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RunbookDraft] = kwargs.pop("cls", None) + + _request = build_runbook_draft_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RunbookDraft, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def undo_edit( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> _models.RunbookDraftUndoEditResult: + """Undo draft edit to last known published state identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: RunbookDraftUndoEditResult. The RunbookDraftUndoEditResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.RunbookDraftUndoEditResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RunbookDraftUndoEditResult] = kwargs.pop("cls", None) + + _request = build_runbook_draft_undo_edit_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RunbookDraftUndoEditResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class TestJobStreamsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`test_job_streams` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, + runbook_name: str, + job_stream_id: str, + **kwargs: Any + ) -> _models.JobStream: + """Retrieve a test job stream of the test job identified by runbook name and stream id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param job_stream_id: The job stream id. Required. + :type job_stream_id: str + :return: JobStream. The JobStream is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.JobStream + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) + + _request = build_test_job_streams_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + job_stream_id=job_stream_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.JobStream, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_test_job( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.JobStream"]: + """Retrieve a list of test job streams identified by runbook name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of JobStream + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.JobStream] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.JobStream]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_test_job_streams_list_by_test_job_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.JobStream], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class TestJobOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`test_job` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: _models.TestJobCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TestJob: + """Create a test job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The parameters supplied to the create test job operation. Required. + :type parameters: ~azure.mgmt.automation.models.TestJobCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TestJob. The TestJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.TestJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TestJob: + """Create a test job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The parameters supplied to the create test job operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TestJob. The TestJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.TestJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TestJob: + """Create a test job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The parameters supplied to the create test job operation. 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: TestJob. The TestJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.TestJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + automation_account_name: str, + runbook_name: str, + parameters: Union[_models.TestJobCreateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.TestJob: + """Create a test job of the runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :param parameters: The parameters supplied to the create test job operation. Is one of the + following types: TestJobCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.TestJobCreateParameters or JSON or IO[bytes] + :return: TestJob. The TestJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.TestJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_test_job_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TestJob, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> _models.TestJob: + """Retrieve the test job for the specified runbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: TestJob. The TestJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.TestJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) + + _request = build_test_job_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TestJob, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def resume( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> None: + """Resume the test job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_test_job_resume_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def stop( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> None: + """Stop the test job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_test_job_stop_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def suspend( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any + ) -> None: + """Suspend the test job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param runbook_name: The runbook name. Required. + :type runbook_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_test_job_suspend_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class ScheduleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`schedule` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, schedule_name: str, **kwargs: Any + ) -> _models.Schedule: + """Retrieve the schedule identified by schedule name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) + + _request = build_schedule_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + schedule_name=schedule_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Schedule, response.json()) + + 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, + schedule_name: str, + parameters: _models.ScheduleCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.Schedule]: + """Create a schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the create or update schedule operation. + Required. + :type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Schedule or None. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + schedule_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.Schedule]: + """Create a schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the create or update schedule operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Schedule or None. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + schedule_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.Schedule]: + """Create a schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the create or update schedule operation. + 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: Schedule or None. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + schedule_name: str, + parameters: Union[_models.ScheduleCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.Schedule]: + """Create a schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the create or update schedule operation. Is one + of the following types: ScheduleCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Schedule or None. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Schedule]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_schedule_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + schedule_name=schedule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 409]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Schedule, response.json()) + + 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, + schedule_name: str, + parameters: _models.ScheduleUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Schedule: + """Update the schedule identified by schedule name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the update schedule operation. Required. + :type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + schedule_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Schedule: + """Update the schedule identified by schedule name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the update schedule operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + schedule_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Schedule: + """Update the schedule identified by schedule name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the update schedule operation. 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: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + schedule_name: str, + parameters: Union[_models.ScheduleUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Schedule: + """Update the schedule identified by schedule name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :param parameters: The parameters supplied to the update schedule operation. Is one of the + following types: ScheduleUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters or JSON or IO[bytes] + :return: Schedule. The Schedule is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Schedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_schedule_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + schedule_name=schedule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Schedule, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, schedule_name: str, **kwargs: Any + ) -> None: + """Delete the schedule identified by schedule name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param schedule_name: The schedule name. Required. + :type schedule_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_schedule_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + schedule_name=schedule_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.Schedule"]: + """Retrieve a list of schedules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Schedule + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Schedule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Schedule]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_schedule_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Schedule], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SourceControlOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`source_control` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, source_control_name: str, **kwargs: Any + ) -> _models.SourceControl: + """Retrieve the source control identified by source control name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) + + _request = build_source_control_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SourceControl, response.json()) + + 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, + source_control_name: str, + parameters: _models.SourceControlCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Create a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the create or update source control operation. + Required. + :type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Create a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the create or update source control operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Create a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the create or update source control operation. + 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: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + parameters: Union[_models.SourceControlCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SourceControl: + """Create a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the create or update source control operation. Is + one of the following types: SourceControlCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters or JSON + or IO[bytes] + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_source_control_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SourceControl, response.json()) + + 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, + source_control_name: str, + parameters: _models.SourceControlUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Update a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the update source control operation. Required. + :type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Update a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the update source control operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Update a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the update source control operation. 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: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + parameters: Union[_models.SourceControlUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SourceControl: + """Update a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param parameters: The parameters supplied to the update source control operation. Is one of + the following types: SourceControlUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters or JSON or + IO[bytes] + :return: SourceControl. The SourceControl is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_source_control_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SourceControl, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, source_control_name: str, **kwargs: Any + ) -> None: + """Delete the source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_source_control_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.SourceControl"]: + """Retrieve a list of source controls. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of SourceControl + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.SourceControl] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SourceControl]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_source_control_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SourceControl], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SourceControlSyncJobOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`source_control_sync_job` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + parameters: _models.SourceControlSyncJobCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControlSyncJob: + """Creates the sync job for a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :param parameters: The parameters supplied to the create source control sync job operation. + Required. + :type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SourceControlSyncJob. The SourceControlSyncJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControlSyncJob: + """Creates the sync job for a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :param parameters: The parameters supplied to the create source control sync job operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SourceControlSyncJob. The SourceControlSyncJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControlSyncJob: + """Creates the sync job for a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :param parameters: The parameters supplied to the create source control sync job operation. + 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: SourceControlSyncJob. The SourceControlSyncJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + parameters: Union[_models.SourceControlSyncJobCreateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SourceControlSyncJob: + """Creates the sync job for a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :param parameters: The parameters supplied to the create source control sync job operation. Is + one of the following types: SourceControlSyncJobCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters or JSON or + IO[bytes] + :return: SourceControlSyncJob. The SourceControlSyncJob is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SourceControlSyncJob] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_source_control_sync_job_create_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + source_control_sync_job_id=source_control_sync_job_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SourceControlSyncJob, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + **kwargs: Any + ) -> _models.SourceControlSyncJobById: + """Retrieve the source control sync job identified by job id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :return: SourceControlSyncJobById. The SourceControlSyncJobById is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobById + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SourceControlSyncJobById] = kwargs.pop("cls", None) + + _request = build_source_control_sync_job_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + source_control_sync_job_id=source_control_sync_job_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SourceControlSyncJobById, response.json()) + + 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, + source_control_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.SourceControlSyncJob"]: + """Retrieve a list of source control sync jobs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of SourceControlSyncJob + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.SourceControlSyncJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SourceControlSyncJob]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_source_control_sync_job_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SourceControlSyncJob], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SourceControlSyncJobStreamsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`source_control_sync_job_streams` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.SourceControlSyncJobStream"]: + """Retrieve a list of sync job streams identified by sync job id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of SourceControlSyncJobStream + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.SourceControlSyncJobStream] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SourceControlSyncJobStream]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_source_control_sync_job_streams_list_by_sync_job_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + source_control_sync_job_id=source_control_sync_job_id, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SourceControlSyncJobStream], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, + resource_group_name: str, + automation_account_name: str, + source_control_name: str, + source_control_sync_job_id: str, + stream_id: str, + **kwargs: Any + ) -> _models.SourceControlSyncJobStreamById: + """Retrieve a sync job stream identified by stream id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param source_control_name: The name of source control. Required. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. Required. + :type source_control_sync_job_id: str + :param stream_id: The id of the sync job stream. Required. + :type stream_id: str + :return: SourceControlSyncJobStreamById. The SourceControlSyncJobStreamById is compatible with + MutableMapping + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobStreamById + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SourceControlSyncJobStreamById] = kwargs.pop("cls", None) + + _request = build_source_control_sync_job_streams_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + source_control_name=source_control_name, + source_control_sync_job_id=source_control_sync_job_id, + stream_id=stream_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SourceControlSyncJobStreamById, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class VariableOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`variable` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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, variable_name: str, **kwargs: Any + ) -> _models.Variable: + """Retrieve the variable identified by variable name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Variable] = kwargs.pop("cls", None) + + _request = build_variable_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + variable_name=variable_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Variable, response.json()) + + 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, + variable_name: str, + parameters: _models.VariableCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Variable: + """Create a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the create or update variable operation. + Required. + :type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + variable_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Variable: + """Create a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the create or update variable operation. + Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + variable_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Variable: + """Create a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the create or update variable operation. + 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: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + variable_name: str, + parameters: Union[_models.VariableCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Variable: + """Create a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the create or update variable operation. Is one + of the following types: VariableCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Variable] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_variable_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + variable_name=variable_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Variable, response.json()) + + 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, + variable_name: str, + parameters: _models.VariableUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Variable: + """Update a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the update variable operation. Required. + :type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + variable_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Variable: + """Update a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the update variable operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + variable_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Variable: + """Update a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the update variable operation. 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: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + variable_name: str, + parameters: Union[_models.VariableUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Variable: + """Update a variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :param parameters: The parameters supplied to the update variable operation. Is one of the + following types: VariableUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters or JSON or IO[bytes] + :return: Variable. The Variable is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Variable + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Variable] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_variable_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + variable_name=variable_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Variable, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, variable_name: str, **kwargs: Any + ) -> None: + """Delete the variable. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param variable_name: The name of variable. Required. + :type variable_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_variable_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + variable_name=variable_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> ItemPaged["_models.Variable"]: + """Retrieve a list of variables. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :return: An iterator like instance of Variable + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Variable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Variable]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_variable_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Variable], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class WatcherOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`watcher` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") @@ -75,18 +24924,529 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: - """Lists all of the available Automation REST API operations. + def get( + self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any + ) -> _models.Watcher: + """Retrieve the watcher identified by watcher name. - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Operation] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) + + _request = build_watcher_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + watcher_name=watcher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Watcher, response.json()) + + 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, + watcher_name: str, + parameters: _models.Watcher, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Watcher: + """Create the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The create or update parameters for watcher. Required. + :type parameters: ~azure.mgmt.automation.models.Watcher + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + watcher_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Watcher: + """Create the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The create or update parameters for watcher. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + watcher_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Watcher: + """Create the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The create or update parameters for watcher. 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: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + watcher_name: str, + parameters: Union[_models.Watcher, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Watcher: + """Create the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The create or update parameters for watcher. Is one of the following types: + Watcher, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.Watcher or JSON or IO[bytes] + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_watcher_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + watcher_name=watcher_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Watcher, response.json()) + + 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, + watcher_name: str, + parameters: _models.WatcherUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Watcher: + """Update the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The update parameters for watcher. Required. + :type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + watcher_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Watcher: + """Update the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The update parameters for watcher. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + watcher_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Watcher: + """Update the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The update parameters for watcher. 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: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + watcher_name: str, + parameters: Union[_models.WatcherUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Watcher: + """Update the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :param parameters: The update parameters for watcher. Is one of the following types: + WatcherUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters or JSON or IO[bytes] + :return: Watcher. The Watcher is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.Watcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_watcher_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + watcher_name=watcher_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Watcher, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any + ) -> None: + """Delete the watcher by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_watcher_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + watcher_name=watcher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.Watcher"]: + """Retrieve a list of watchers. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :return: An iterator like instance of Watcher + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Watcher] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Watcher]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -99,25 +25459,56 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_watcher_list_by_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Watcher], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -130,12 +25521,393 @@ 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( + error = _failsafe_deserialize( _models.ErrorResponse, - pipeline_response, + response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) + + @distributed_trace + def start( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any + ) -> None: + """Resume the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_watcher_start_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + watcher_name=watcher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def stop( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any + ) -> None: + """Resume the watcher identified by watcher name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param watcher_name: The watcher name. Required. + :type watcher_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_watcher_stop_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + watcher_name=watcher_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + 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_subscription(self, **kwargs: Any) -> _models.DeletedAutomationAccountListResult: + """Retrieve deleted automation account. + + :return: DeletedAutomationAccountListResult. The DeletedAutomationAccountListResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.DeletedAutomationAccountListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeletedAutomationAccountListResult] = kwargs.pop("cls", None) + + _request = build_deleted_automation_accounts_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DeletedAutomationAccountListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class _AutomationClientOperationsMixin( + ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], AutomationClientConfiguration] +): + + @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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The GraphicalRunbookContent is compatible with MutableMapping + :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: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.GraphicalRunbookContent: + """Post operation to serialize or deserialize GraphRunbookContent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Input data describing the graphical runbook. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: GraphicalRunbookContent. The GraphicalRunbookContent is compatible with MutableMapping + :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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param 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. The GraphicalRunbookContent is compatible with MutableMapping + :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, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.GraphicalRunbookContent: + """Post operation to serialize or deserialize GraphRunbookContent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param parameters: Input data describing the graphical runbook. Is one of the following types: + GraphicalRunbookContent, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.automation.models.GraphicalRunbookContent or JSON or IO[bytes] + :return: GraphicalRunbookContent. The GraphicalRunbookContent is compatible with MutableMapping + :rtype: ~azure.mgmt.automation.models.GraphicalRunbookContent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_automation_convert_graph_runbook_content_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.GraphicalRunbookContent, response.json()) + + 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/_patch.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_patch.py index 49900f6ab120..ea765788358a 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 @@ -1,15 +1,14 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): 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 deleted file mode 100644 index 8c66c525d690..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python2_package_operations.py +++ /dev/null @@ -1,739 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_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", "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}", - ) - 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", "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}", - ) - 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", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/python2Packages/{packageName}", - ) - 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", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/python2Packages/{packageName}", - ) - 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", "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", - ) - 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 Python2PackageOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`python2_package` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - self, resource_group_name: str, automation_account_name: str, package_name: str, **kwargs: Any - ) -> None: - """Delete the python 2 package by name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - 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]: - map_error(status_code=response.status_code, 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The name of python package. Required. - :type package_name: str - :param parameters: The create or update parameters for python package. 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The name of python package. Required. - :type package_name: str - :param parameters: The create or update parameters for python package. 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The name of python package. Required. - :type package_name: str - :param parameters: The create or update parameters for python package. Is either a - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The name of python package. Required. - :type package_name: str - :param parameters: The update parameters for python package. 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The name of python package. Required. - :type package_name: str - :param parameters: The update parameters for python package. 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 2 package identified by package name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param package_name: The name of python package. Required. - :type package_name: str - :param parameters: The update parameters for python package. Is either a - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - 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 - ) -> ItemPaged["_models.Module"]: - """Retrieve a list of python 2 packages. - - .. seealso:: - - http://aka.ms/azureautomationsdk/moduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :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", "2018-06-30")) - cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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 deleted file mode 100644 index ed0999086a94..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_draft_operations.py +++ /dev/null @@ -1,548 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_content_request( - resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_replace_content_request( - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - subscription_id: str, - *, - content: IO[bytes], - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/runbooks/{runbookName}/draft/content", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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, content=content, **kwargs) - - -def build_get_request( - resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_undo_edit_request( - resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class RunbookDraftOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`runbook_draft` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> Iterator[bytes]: - """Retrieve the content of runbook draft identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookdraftoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: Iterator[bytes] or the result of cls(response) - :rtype: Iterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_get_content_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _replace_content_initial( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - runbook_content: IO[bytes], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _content = runbook_content - - _request = build_replace_content_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_replace_content( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - runbook_content: IO[bytes], - **kwargs: Any - ) -> LROPoller[Iterator[bytes]]: - """Replaces the runbook draft content. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookdraftoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :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) - :rtype: ~azure.core.polling.LROPoller[Iterator[bytes]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._replace_content_initial( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_name, - runbook_content=runbook_content, - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - 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[Iterator[bytes]].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[Iterator[bytes]]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> _models.RunbookDraft: - """Retrieve the runbook draft identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookdraftoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: RunbookDraft or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.RunbookDraft - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.RunbookDraft] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("RunbookDraft", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def undo_edit( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> _models.RunbookDraftUndoEditResult: - """Undo draft edit to last known published state identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookdraftoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: RunbookDraftUndoEditResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.RunbookDraftUndoEditResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.RunbookDraftUndoEditResult] = kwargs.pop("cls", None) - - _request = build_undo_edit_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("RunbookDraftUndoEditResult", 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/_runbook_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_operations.py deleted file mode 100644 index f85ad9e1bf8f..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_operations.py +++ /dev/null @@ -1,999 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, 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 -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_publish_request( - resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_content_request( - resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_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, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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}", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_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, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/runbooks/{runbookName}", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/runbooks/{runbookName}", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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}", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_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", "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", - ) - 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 RunbookOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`runbook` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_publish_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_publish( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Publish runbook draft. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookdraftoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The parameters supplied to the publish runbook operation. Required. - :type runbook_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", "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) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._publish_initial( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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 - - @distributed_trace - def get_content( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> Iterator[bytes]: - """Retrieve the content of runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: Iterator[bytes] or the result of cls(response) - :rtype: Iterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_get_content_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> _models.Runbook: - """Retrieve the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("Runbook", 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, - runbook_name: str, - parameters: _models.RunbookCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Runbook: - """Create the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param parameters: The create or update parameters for runbook. Provide either content link for - a published runbook or draft, not both. Required. - :type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Runbook: - """Create the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param parameters: The create or update parameters for runbook. Provide either content link for - a published runbook or draft, not both. 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: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: Union[_models.RunbookCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Runbook: - """Create the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param parameters: The create or update parameters for runbook. Provide either content link for - a published runbook or draft, not both. Is either a RunbookCreateOrUpdateParameters type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters or IO[bytes] - :return: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RunbookCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("Runbook", 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, - runbook_name: str, - parameters: _models.RunbookUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Runbook: - """Update the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param parameters: The update parameters for runbook. Required. - :type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Runbook: - """Update the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param parameters: The update parameters for runbook. 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: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: Union[_models.RunbookUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Runbook: - """Update the runbook identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param parameters: The update parameters for runbook. Is either a RunbookUpdateParameters type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters or IO[bytes] - :return: Runbook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Runbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RunbookUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("Runbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> None: - """Delete the runbook by name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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 list_by_automation_account( - self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> ItemPaged["_models.Runbook"]: - """Retrieve a list of runbooks. - - .. seealso:: - - http://aka.ms/azureautomationsdk/runbookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Runbook or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Runbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.RunbookListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("RunbookListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_schedule_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_schedule_operations.py deleted file mode 100644 index ee1e7b3902b8..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_schedule_operations.py +++ /dev/null @@ -1,742 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, automation_account_name: str, schedule_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", - ) - 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"), - "scheduleName": _SERIALIZER.url("schedule_name", schedule_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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, schedule_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", - ) - 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"), - "scheduleName": _SERIALIZER.url("schedule_name", schedule_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, automation_account_name: str, schedule_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}", - ) - 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"), - "scheduleName": _SERIALIZER.url("schedule_name", schedule_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, automation_account_name: str, schedule_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}", - ) - 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"), - "scheduleName": _SERIALIZER.url("schedule_name", schedule_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_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", "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", - ) - 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 ScheduleOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`schedule` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - schedule_name: str, - parameters: _models.ScheduleCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.Schedule]: - """Create a schedule. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :param parameters: The parameters supplied to the create or update schedule operation. - Required. - :type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Schedule or None or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - schedule_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Optional[_models.Schedule]: - """Create a schedule. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :param parameters: The parameters supplied to the create or update schedule operation. - 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: Schedule or None or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - schedule_name: str, - parameters: Union[_models.ScheduleCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.Schedule]: - """Create a schedule. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :param parameters: The parameters supplied to the create or update schedule operation. Is - either a ScheduleCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters or IO[bytes] - :return: Schedule or None or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ScheduleCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - schedule_name=schedule_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, 409]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - deserialized = self._deserialize("Schedule", 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, - schedule_name: str, - parameters: _models.ScheduleUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Schedule: - """Update the schedule identified by schedule name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :param parameters: The parameters supplied to the update schedule operation. Required. - :type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Schedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - schedule_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Schedule: - """Update the schedule identified by schedule name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :param parameters: The parameters supplied to the update schedule operation. 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: Schedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - automation_account_name: str, - schedule_name: str, - parameters: Union[_models.ScheduleUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Schedule: - """Update the schedule identified by schedule name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :param parameters: The parameters supplied to the update schedule operation. Is either a - ScheduleUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters or IO[bytes] - :return: Schedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ScheduleUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - schedule_name=schedule_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("Schedule", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, schedule_name: str, **kwargs: Any - ) -> _models.Schedule: - """Retrieve the schedule identified by schedule name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :return: Schedule or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - schedule_name=schedule_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("Schedule", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, schedule_name: str, **kwargs: Any - ) -> None: - """Delete the schedule identified by schedule name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param schedule_name: The schedule name. Required. - :type schedule_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - schedule_name=schedule_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_by_automation_account( - self, resource_group_name: str, automation_account_name: str, **kwargs: Any - ) -> ItemPaged["_models.Schedule"]: - """Retrieve a list of schedules. - - .. seealso:: - - http://aka.ms/azureautomationsdk/scheduleoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Schedule or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Schedule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("ScheduleListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_software_update_configuration_machine_runs_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_machine_runs_operations.py deleted file mode 100644 index e7d143de4064..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_machine_runs_operations.py +++ /dev/null @@ -1,311 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_by_id_request( - resource_group_name: str, - automation_account_name: str, - software_update_configuration_machine_run_id: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "softwareUpdateConfigurationMachineRunId": _SERIALIZER.url( - "software_update_configuration_machine_run_id", software_update_configuration_machine_run_id, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - automation_account_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - filter: Optional[str] = None, - skip: Optional[str] = None, - top: 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", "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", - ) - 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") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if skip is not None: - _params["$skip"] = _SERIALIZER.query("skip", skip, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SoftwareUpdateConfigurationMachineRunsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`software_update_configuration_machine_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_machine_run_id: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfigurationMachineRun: - """Get a single software update configuration machine run by Id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_machine_run_id: The Id of the software update - configuration machine run. Required. - :type software_update_configuration_machine_run_id: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: SoftwareUpdateConfigurationMachineRun or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - software_update_configuration_machine_run_id=software_update_configuration_machine_run_id, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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("SoftwareUpdateConfigurationMachineRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - automation_account_name: str, - client_request_id: Optional[str] = None, - filter: Optional[str] = None, - skip: Optional[str] = None, - top: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfigurationMachineRunListResult: - """Return list of software update configuration machine runs. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :param filter: The filter to apply on the operation. You can use the following filters: - 'properties/osType', 'properties/status', 'properties/startTime', and - 'properties/softwareUpdateConfiguration/name'. Default value is None. - :type filter: str - :param skip: number of entries you skip before returning results. Default value is None. - :type skip: str - :param top: Maximum number of entries returned in the results collection. Default value is - None. - :type top: str - :return: SoftwareUpdateConfigurationMachineRunListResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRunListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_id, - filter=filter, - skip=skip, - top=top, - 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( - "SoftwareUpdateConfigurationMachineRunListResult", 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/_software_update_configuration_runs_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_runs_operations.py deleted file mode 100644 index c8e3342a9b1e..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_runs_operations.py +++ /dev/null @@ -1,309 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_by_id_request( - resource_group_name: str, - automation_account_name: str, - software_update_configuration_run_id: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "softwareUpdateConfigurationRunId": _SERIALIZER.url( - "software_update_configuration_run_id", software_update_configuration_run_id, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - automation_account_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - filter: Optional[str] = None, - skip: Optional[str] = None, - top: 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", "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", - ) - 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") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if skip is not None: - _params["$skip"] = _SERIALIZER.query("skip", skip, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SoftwareUpdateConfigurationRunsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`software_update_configuration_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_run_id: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfigurationRun: - """Get a single software update configuration Run by Id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationrunoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_run_id: The Id of the software update configuration run. - Required. - :type software_update_configuration_run_id: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: SoftwareUpdateConfigurationRun or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - software_update_configuration_run_id=software_update_configuration_run_id, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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("SoftwareUpdateConfigurationRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - automation_account_name: str, - client_request_id: Optional[str] = None, - filter: Optional[str] = None, - skip: Optional[str] = None, - top: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfigurationRunListResult: - """Return list of software update configuration runs. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :param filter: The filter to apply on the operation. You can use the following filters: - 'properties/osType', 'properties/status', 'properties/startTime', and - 'properties/softwareUpdateConfiguration/name'. Default value is None. - :type filter: str - :param skip: Number of entries you skip before returning results. Default value is None. - :type skip: str - :param top: Maximum number of entries returned in the results collection. Default value is - None. - :type top: str - :return: SoftwareUpdateConfigurationRunListResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_id, - filter=filter, - skip=skip, - top=top, - 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("SoftwareUpdateConfigurationRunListResult", 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/_software_update_configurations_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configurations_operations.py deleted file mode 100644 index a55dc194f94a..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configurations_operations.py +++ /dev/null @@ -1,618 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request( - resource_group_name: str, - automation_account_name: str, - software_update_configuration_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-05-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}", - ) - 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"), - "softwareUpdateConfigurationName": _SERIALIZER.url( - "software_update_configuration_name", software_update_configuration_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_by_name_request( - resource_group_name: str, - automation_account_name: str, - software_update_configuration_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "softwareUpdateConfigurationName": _SERIALIZER.url( - "software_update_configuration_name", software_update_configuration_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - automation_account_name: str, - software_update_configuration_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "softwareUpdateConfigurationName": _SERIALIZER.url( - "software_update_configuration_name", software_update_configuration_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - automation_account_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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", - ) - 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") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - if client_request_id is not None: - _headers["clientRequestId"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SoftwareUpdateConfigurationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`software_update_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_name: str, - parameters: _models.SoftwareUpdateConfiguration, - client_request_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SoftwareUpdateConfiguration: - """Create a new software update configuration with the name given in the URI. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_name: The name of the software update configuration to be - created. Required. - :type software_update_configuration_name: str - :param parameters: Request body. Required. - :type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SoftwareUpdateConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_name: str, - parameters: IO[bytes], - client_request_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SoftwareUpdateConfiguration: - """Create a new software update configuration with the name given in the URI. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_name: The name of the software update configuration to be - created. Required. - :type software_update_configuration_name: str - :param parameters: Request body. Required. - :type parameters: IO[bytes] - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SoftwareUpdateConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_name: str, - parameters: Union[_models.SoftwareUpdateConfiguration, IO[bytes]], - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfiguration: - """Create a new software update configuration with the name given in the URI. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_name: The name of the software update configuration to be - created. Required. - :type software_update_configuration_name: str - :param parameters: Request body. Is either a SoftwareUpdateConfiguration type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration or IO[bytes] - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: SoftwareUpdateConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SoftwareUpdateConfiguration") - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - software_update_configuration_name=software_update_configuration_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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("SoftwareUpdateConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_by_name( - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfiguration: - """Get a single software update configuration by name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_name: The name of the software update configuration to be - created. Required. - :type software_update_configuration_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: SoftwareUpdateConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - software_update_configuration_name=software_update_configuration_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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("SoftwareUpdateConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - automation_account_name: str, - software_update_configuration_name: str, - client_request_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """delete a specific software update configuration. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param software_update_configuration_name: The name of the software update configuration to be - created. Required. - :type software_update_configuration_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - software_update_configuration_name=software_update_configuration_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_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 list( - self, - resource_group_name: str, - automation_account_name: str, - client_request_id: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any - ) -> _models.SoftwareUpdateConfigurationListResult: - """Get all software update configurations for the account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param client_request_id: Identifies this specific client request. Default value is None. - :type client_request_id: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :return: SoftwareUpdateConfigurationListResult or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - subscription_id=self._config.subscription_id, - client_request_id=client_request_id, - filter=filter, - 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("SoftwareUpdateConfigurationListResult", 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/_source_control_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_operations.py deleted file mode 100644 index 956352d3d912..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_operations.py +++ /dev/null @@ -1,768 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", - ) - 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"), - "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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, - source_control_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", - ) - 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"), - "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}", - ) - 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"), - "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # 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, - source_control_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}", - ) - 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"), - "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_automation_account_request( - resource_group_name: str, - automation_account_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", "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", - ) - 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 - 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 SourceControlOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`source_control` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - parameters: _models.SourceControlCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SourceControl: - """Create a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param parameters: The parameters supplied to the create or update source control operation. - Required. - :type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SourceControl: - """Create a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param parameters: The parameters supplied to the create or update source control operation. - 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: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - parameters: Union[_models.SourceControlCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.SourceControl: - """Create a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param parameters: The parameters supplied to the create or update source control operation. Is - either a SourceControlCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters or - IO[bytes] - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SourceControlCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_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("SourceControl", 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, - source_control_name: str, - parameters: _models.SourceControlUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SourceControl: - """Update a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param parameters: The parameters supplied to the update source control operation. Required. - :type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SourceControl: - """Update a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param parameters: The parameters supplied to the update source control operation. 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: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - parameters: Union[_models.SourceControlUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.SourceControl: - """Update a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param parameters: The parameters supplied to the update source control operation. Is either a - SourceControlUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters or IO[bytes] - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SourceControlUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_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("SourceControl", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, source_control_name: str, **kwargs: Any - ) -> None: - """Delete the source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The name of source control. Required. - :type source_control_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, source_control_name: str, **kwargs: Any - ) -> _models.SourceControl: - """Retrieve the source control identified by source control name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The name of source control. Required. - :type source_control_name: str - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControl - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_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("SourceControl", 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, filter: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.SourceControl"]: - """Retrieve a list of source controls. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontroloperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 SourceControl or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.SourceControl] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("SourceControlListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_source_control_sync_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_operations.py deleted file mode 100644 index 7309ece1dc4c..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_operations.py +++ /dev/null @@ -1,510 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request( - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_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", "2017-05-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}", - ) - 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"), - "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), - "sourceControlSyncJobId": _SERIALIZER.url("source_control_sync_job_id", source_control_sync_job_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_get_request( - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_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", "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}", - ) - 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"), - "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), - "sourceControlSyncJobId": _SERIALIZER.url("source_control_sync_job_id", source_control_sync_job_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_list_by_automation_account_request( - resource_group_name: str, - automation_account_name: str, - source_control_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", "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", - ) - 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"), - "sourceControlName": _SERIALIZER.url("source_control_name", source_control_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 SourceControlSyncJobOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`source_control_sync_job` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: str, - parameters: _models.SourceControlSyncJobCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SourceControlSyncJob: - """Creates the sync job for a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param source_control_sync_job_id: The source control sync job id. Required. - :type source_control_sync_job_id: str - :param parameters: The parameters supplied to the create source control sync job operation. - Required. - :type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SourceControlSyncJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SourceControlSyncJob: - """Creates the sync job for a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param source_control_sync_job_id: The source control sync job id. Required. - :type source_control_sync_job_id: str - :param parameters: The parameters supplied to the create source control sync job operation. - 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: SourceControlSyncJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: str, - parameters: Union[_models.SourceControlSyncJobCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.SourceControlSyncJob: - """Creates the sync job for a source control. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param source_control_sync_job_id: The source control sync job id. Required. - :type source_control_sync_job_id: str - :param parameters: The parameters supplied to the create source control sync job operation. Is - either a SourceControlSyncJobCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters or - IO[bytes] - :return: SourceControlSyncJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SourceControlSyncJobCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_name, - source_control_sync_job_id=source_control_sync_job_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 [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("SourceControlSyncJob", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: str, - **kwargs: Any - ) -> _models.SourceControlSyncJobById: - """Retrieve the source control sync job identified by job id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param source_control_sync_job_id: The source control sync job id. Required. - :type source_control_sync_job_id: str - :return: SourceControlSyncJobById or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobById - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_name, - source_control_sync_job_id=source_control_sync_job_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("SourceControlSyncJobById", 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, - source_control_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.SourceControlSyncJob"]: - """Retrieve a list of source control sync jobs. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_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 SourceControlSyncJob or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.SourceControlSyncJob] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - source_control_name=source_control_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("SourceControlSyncJobListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_source_control_sync_job_streams_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_streams_operations.py deleted file mode 100644 index d1f2fccea549..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_streams_operations.py +++ /dev/null @@ -1,315 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_sync_job_request( - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: 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", "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", - ) - 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"), - "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), - "sourceControlSyncJobId": _SERIALIZER.url("source_control_sync_job_id", source_control_sync_job_id, "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) - - -def build_get_request( - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: str, - stream_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", "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}", - ) - 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"), - "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, "str"), - "sourceControlSyncJobId": _SERIALIZER.url("source_control_sync_job_id", source_control_sync_job_id, "str"), - "streamId": _SERIALIZER.url("stream_id", stream_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) - - -class SourceControlSyncJobStreamsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`source_control_sync_job_streams` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.SourceControlSyncJobStream"]: - """Retrieve a list of sync job streams identified by sync job id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param source_control_sync_job_id: The source control sync job id. Required. - :type source_control_sync_job_id: str - :param filter: The filter to apply on the operation. Default value is None. - :type filter: str - :return: An iterator like instance of either SourceControlSyncJobStream or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.SourceControlSyncJobStream] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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_sync_job_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_name, - source_control_sync_job_id=source_control_sync_job_id, - 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("SourceControlSyncJobStreamsListBySyncJob", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, - resource_group_name: str, - automation_account_name: str, - source_control_name: str, - source_control_sync_job_id: str, - stream_id: str, - **kwargs: Any - ) -> _models.SourceControlSyncJobStreamById: - """Retrieve a sync job stream identified by stream id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param source_control_name: The source control name. Required. - :type source_control_name: str - :param source_control_sync_job_id: The source control sync job id. Required. - :type source_control_sync_job_id: str - :param stream_id: The id of the sync job stream. Required. - :type stream_id: str - :return: SourceControlSyncJobStreamById or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobStreamById - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - source_control_name=source_control_name, - source_control_sync_job_id=source_control_sync_job_id, - stream_id=stream_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("SourceControlSyncJobStreamById", 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/_statistics_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_statistics_operations.py deleted file mode 100644 index 784ddf26410a..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_statistics_operations.py +++ /dev/null @@ -1,178 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_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, - *, - 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", "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", - ) - 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 - 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 StatisticsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`statistics` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - ) -> ItemPaged["_models.Statistics"]: - """Retrieve the statistics for the account. - - .. seealso:: - - http://aka.ms/azureautomationsdk/statisticsoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 Statistics or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Statistics] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("StatisticsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/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 deleted file mode 100644 index 2296bcafe001..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_operations.py +++ /dev/null @@ -1,632 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request( - resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/runbooks/{runbookName}/draft/testJob", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_resume_request( - resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_suspend_request( - resource_group_name: str, automation_account_name: str, runbook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-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", - ) - 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"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class TestJobOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`test_job` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: _models.TestJobCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TestJob: - """Create a test job of the runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The parameters supplied to the create test job operation. Required. - :type runbook_name: str - :param parameters: The parameters supplied to the create test job operation. Required. - :type parameters: ~azure.mgmt.automation.models.TestJobCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TestJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.TestJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TestJob: - """Create a test job of the runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The parameters supplied to the create test job operation. Required. - :type runbook_name: str - :param parameters: The parameters supplied to the create test job operation. 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: TestJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.TestJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - parameters: Union[_models.TestJobCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.TestJob: - """Create a test job of the runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The parameters supplied to the create test job operation. Required. - :type runbook_name: str - :param parameters: The parameters supplied to the create test job operation. Is either a - TestJobCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.TestJobCreateParameters or IO[bytes] - :return: TestJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.TestJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "TestJobCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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 [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("TestJob", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> _models.TestJob: - """Retrieve the test job for the specified runbook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: TestJob or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.TestJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("TestJob", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def resume( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> None: - """Resume the test job. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_resume_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def stop( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> None: - """Stop the test job. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def suspend( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, runbook_name: str, **kwargs: Any - ) -> None: - """Suspend the test job. - - .. seealso:: - - http://aka.ms/azureautomationsdk/testjoboperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_suspend_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore 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 deleted file mode 100644 index d73c5404b369..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_streams_operations.py +++ /dev/null @@ -1,302 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - job_stream_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", "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}", - ) - 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"), - "jobStreamId": _SERIALIZER.url("job_stream_id", job_stream_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_test_job_request( - resource_group_name: str, - automation_account_name: str, - runbook_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", "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", - ) - 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"), - } - - _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 TestJobStreamsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`test_job_streams` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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, - runbook_name: str, - job_stream_id: str, - **kwargs: Any - ) -> _models.JobStream: - """Retrieve a test job stream of the test job identified by runbook name and stream id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobstreamoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_name: str - :param job_stream_id: The job stream id. Required. - :type job_stream_id: str - :return: JobStream or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.JobStream - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_name, - job_stream_id=job_stream_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("JobStream", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_test_job( - self, - resource_group_name: str, - automation_account_name: str, - runbook_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.JobStream"]: - """Retrieve a list of test job streams identified by runbook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/jobstreamoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param runbook_name: The runbook name. Required. - :type runbook_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 JobStream or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.JobStream] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-30")) - cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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_test_job_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_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("JobStreamListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_usages_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_usages_operations.py deleted file mode 100644 index e3c5140dfb0d..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_usages_operations.py +++ /dev/null @@ -1,168 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_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", "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", - ) - 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 UsagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`usages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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 - ) -> ItemPaged["_models.Usage"]: - """Retrieve the usage for the account id. - - .. seealso:: - - http://aka.ms/azureautomationsdk/usageoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Usage or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Usage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("UsageListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_variable_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_variable_operations.py deleted file mode 100644 index 6b4ea3e33c7f..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_variable_operations.py +++ /dev/null @@ -1,741 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, automation_account_name: str, variable_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", - ) - 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"), - "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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, variable_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", - ) - 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"), - "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, automation_account_name: str, variable_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}", - ) - 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"), - "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # 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, variable_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}", - ) - 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"), - "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_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", "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", - ) - 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 VariableOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`variable` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - variable_name: str, - parameters: _models.VariableCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Variable: - """Create a variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The variable name. Required. - :type variable_name: str - :param parameters: The parameters supplied to the create or update variable operation. - Required. - :type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - variable_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Variable: - """Create a variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The variable name. Required. - :type variable_name: str - :param parameters: The parameters supplied to the create or update variable operation. - 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: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - variable_name: str, - parameters: Union[_models.VariableCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Variable: - """Create a variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The variable name. Required. - :type variable_name: str - :param parameters: The parameters supplied to the create or update variable operation. Is - either a VariableCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters or IO[bytes] - :return: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VariableCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - variable_name=variable_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("Variable", 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, - variable_name: str, - parameters: _models.VariableUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Variable: - """Update a variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The variable name. Required. - :type variable_name: str - :param parameters: The parameters supplied to the update variable operation. Required. - :type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - variable_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Variable: - """Update a variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The variable name. Required. - :type variable_name: str - :param parameters: The parameters supplied to the update variable operation. 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: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - automation_account_name: str, - variable_name: str, - parameters: Union[_models.VariableUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Variable: - """Update a variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The variable name. Required. - :type variable_name: str - :param parameters: The parameters supplied to the update variable operation. Is either a - VariableUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters or IO[bytes] - :return: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VariableUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - variable_name=variable_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("Variable", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, variable_name: str, **kwargs: Any - ) -> None: - """Delete the variable. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The name of variable. Required. - :type variable_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - variable_name=variable_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, variable_name: str, **kwargs: Any - ) -> _models.Variable: - """Retrieve the variable identified by variable name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param variable_name: The name of variable. Required. - :type variable_name: str - :return: Variable or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Variable - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - variable_name=variable_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("Variable", 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 - ) -> ItemPaged["_models.Variable"]: - """Retrieve a list of variables. - - .. seealso:: - - http://aka.ms/azureautomationsdk/variableoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: An iterator like instance of either Variable or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Variable] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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("VariableListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_watcher_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_watcher_operations.py deleted file mode 100644 index 049596285968..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_watcher_operations.py +++ /dev/null @@ -1,941 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, automation_account_name: str, watcher_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/watchers/{watcherName}", - ) - 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"), - "watcherName": _SERIALIZER.url("watcher_name", watcher_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, automation_account_name: str, watcher_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "watcherName": _SERIALIZER.url("watcher_name", watcher_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, automation_account_name: str, watcher_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _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}/watchers/{watcherName}", - ) - 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"), - "watcherName": _SERIALIZER.url("watcher_name", watcher_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, automation_account_name: str, watcher_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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}", - ) - 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"), - "watcherName": _SERIALIZER.url("watcher_name", watcher_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, automation_account_name: str, watcher_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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", - ) - 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"), - "watcherName": _SERIALIZER.url("watcher_name", watcher_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, automation_account_name: str, watcher_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "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", - ) - 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"), - "watcherName": _SERIALIZER.url("watcher_name", watcher_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", 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, - *, - 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", "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", - ) - 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 - 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 WatcherOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`watcher` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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( - self, - resource_group_name: str, - automation_account_name: str, - watcher_name: str, - parameters: _models.Watcher, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Watcher: - """Create the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :param parameters: The create or update parameters for watcher. Required. - :type parameters: ~azure.mgmt.automation.models.Watcher - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - watcher_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Watcher: - """Create the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :param parameters: The create or update parameters for watcher. 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: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - watcher_name: str, - parameters: Union[_models.Watcher, IO[bytes]], - **kwargs: Any - ) -> _models.Watcher: - """Create the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :param parameters: The create or update parameters for watcher. Is either a Watcher type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.Watcher or IO[bytes] - :return: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Watcher") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - watcher_name=watcher_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("Watcher", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any - ) -> _models.Watcher: - """Retrieve the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :return: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - watcher_name=watcher_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("Watcher", 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, - watcher_name: str, - parameters: _models.WatcherUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Watcher: - """Update the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :param parameters: The update parameters for watcher. Required. - :type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - watcher_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Watcher: - """Update the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :param parameters: The update parameters for watcher. 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: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - automation_account_name: str, - watcher_name: str, - parameters: Union[_models.WatcherUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Watcher: - """Update the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :param parameters: The update parameters for watcher. Is either a WatcherUpdateParameters type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters or IO[bytes] - :return: Watcher or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Watcher - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "WatcherUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - watcher_name=watcher_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("Watcher", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any - ) -> None: - """Delete the watcher by name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - watcher_name=watcher_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def start( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any - ) -> None: - """Resume the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - watcher_name=watcher_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def stop( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, watcher_name: str, **kwargs: Any - ) -> None: - """Resume the watcher identified by watcher name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param watcher_name: The watcher name. Required. - :type watcher_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - watcher_name=watcher_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_by_automation_account( - self, resource_group_name: str, automation_account_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.Watcher"]: - """Retrieve a list of watchers. - - .. seealso:: - - http://aka.ms/azureautomationsdk/watcheroperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 Watcher or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Watcher] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("WatcherListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/_webhook_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_webhook_operations.py deleted file mode 100644 index 9b7b37b0594a..000000000000 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_webhook_operations.py +++ /dev/null @@ -1,843 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -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 .._configuration import AutomationClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_generate_uri_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", "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}/webhooks/generateUri", - ) - 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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, automation_account_name: str, webhook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}/webhooks/{webhookName}", - ) - 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"), - "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # 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, webhook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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}/webhooks/{webhookName}", - ) - 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"), - "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_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, webhook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", - ) - 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"), - "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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, webhook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", - ) - 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"), - "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_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, - *, - 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", "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}/webhooks", - ) - 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 - 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 WebhookOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.automation.AutomationClient`'s - :attr:`webhook` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - 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: - """Generates a Uri for use in creating a webhook. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :return: str or the result of cls(response) - :rtype: str - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - cls: ClsType[str] = kwargs.pop("cls", None) - - _request = build_generate_uri_request( - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, automation_account_name: str, webhook_name: str, **kwargs: Any - ) -> None: - """Delete the webhook by name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - webhook_name=webhook_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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, automation_account_name: str, webhook_name: str, **kwargs: Any - ) -> _models.Webhook: - """Retrieve the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :return: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - webhook_name=webhook_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("Webhook", 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, - webhook_name: str, - parameters: _models.WebhookCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Webhook: - """Create the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :param parameters: The create or update parameters for webhook. Required. - :type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - webhook_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Webhook: - """Create the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :param parameters: The create or update parameters for webhook. 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: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - automation_account_name: str, - webhook_name: str, - parameters: Union[_models.WebhookCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Webhook: - """Create the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :param parameters: The create or update parameters for webhook. Is either a - WebhookCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters or IO[bytes] - :return: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "WebhookCreateOrUpdateParameters") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - webhook_name=webhook_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("Webhook", 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, - webhook_name: str, - parameters: _models.WebhookUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Webhook: - """Update the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :param parameters: The update parameters for webhook. Required. - :type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - automation_account_name: str, - webhook_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Webhook: - """Update the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :param parameters: The update parameters for webhook. 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: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - automation_account_name: str, - webhook_name: str, - parameters: Union[_models.WebhookUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Webhook: - """Update the webhook identified by webhook name. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_name: str - :param webhook_name: The webhook name. Required. - :type webhook_name: str - :param parameters: The update parameters for webhook. Is either a WebhookUpdateParameters type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters or IO[bytes] - :return: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.automation.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "WebhookUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - webhook_name=webhook_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("Webhook", 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, filter: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.Webhook"]: - """Retrieve a list of webhooks. - - .. seealso:: - - http://aka.ms/azureautomationsdk/webhookoperations - - :param resource_group_name: Name of an Azure Resource group. Required. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. Required. - :type automation_account_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 Webhook or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: 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, - 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("WebhookListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=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/generated_samples/job/create_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_job.py similarity index 83% rename from sdk/automation/azure-mgmt-automation/generated_samples/job/create_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/create_job.py index d5807285a722..c83828bdae20 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/create_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_job.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.job.create( @@ -46,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/job/createJob.json +# x-ms-original-file: 2024-10-23/job/createJob.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 cef55169f6c4..ead3dab3dd50 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.job_schedule.create( @@ -46,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createJobSchedule.json +# x-ms-original-file: 2024-10-23/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 10b580f76b5e..14d5d82d4217 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.automation_account.create_or_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createOrUpdateAutomationAccount.json +# x-ms-original-file: 2024-10-23/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 241bccb3a6a6..5d642361746e 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.certificate.create_or_update( @@ -48,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createOrUpdateCertificate.json +# x-ms-original-file: 2024-10-23/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 c43c8d50a088..5478ebe1817d 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.connection.create_or_update( @@ -40,13 +39,16 @@ def main(): "properties": { "connectionType": {"name": "Azure"}, "description": "my description goes here", - "fieldDefinitionValues": {"AutomationCertificateName": "mysCertificateName", "SubscriptionID": "subid"}, + "fieldDefinitionValues": { + "AutomationCertificateName": "mysCertificateName", + "SubscriptionID": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + }, }, }, ) print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createOrUpdateConnection.json +# x-ms-original-file: 2024-10-23/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 4f15d9e8ec33..8ff2c6e5458d 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.connection_type.create_or_update( @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createOrUpdateConnectionType.json +# x-ms-original-file: 2024-10-23/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 947f94965bd3..9f95248e9c5b 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.credential.create_or_update( @@ -47,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createOrUpdateCredential.json +# x-ms-original-file: 2024-10-23/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 04839c31c98f..c9861336eb6f 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 @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_configuration.create_or_update( @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createOrUpdateDscConfiguration.json +# x-ms-original-file: 2024-10-23/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 3bb73c136261..c539d1b05a4a 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 @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node_configuration.begin_create_or_update( @@ -55,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/createOrUpdateDscNodeConfiguration.json +# x-ms-original-file: 2024-10-23/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 9c486e332a38..62c34b996ccf 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.module.create_or_update( @@ -51,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createOrUpdateModule.json +# x-ms-original-file: 2024-10-23/createOrUpdateModule.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_or_update_package.py similarity index 60% rename from sdk/automation/azure-mgmt-automation/generated_samples/create_compilation_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_package.py index 2da03dd40cf9..6c1440c053f3 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_compilation_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_package.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -16,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-automation # USAGE - python create_compilation_job.py + python create_or_update_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, @@ -28,18 +27,29 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.dsc_compilation_job.begin_create( + response = client.package.create_or_update( resource_group_name="rg", automation_account_name="myAutomationAccount33", - compilation_job_name="TestCompilationJob", - parameters={"properties": {"configuration": {"name": "SetupServer"}}}, - ).result() + runtime_environment_name="runtimeEnvironmentName", + package_name="OmsCompositeResources", + parameters={ + "properties": { + "contentLink": { + "contentHash": { + "algorithm": "sha265", + "value": "07E108A962B81DD9C9BAA89BB47C0F6EE52B29E83758B07795E408D258B2B87A", + }, + "uri": "https://teststorage.blob.core.windows.net/dsccomposite/OmsCompositeResources.zip", + } + } + }, + ) print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/createCompilationJob.json +# x-ms-original-file: 2024-10-23/package/createOrUpdatePackage.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 83e98666fab9..794aa6531f61 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.python2_package.create_or_update( @@ -52,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/createOrUpdatePython2Package.json +# x-ms-original-file: 2024-10-23/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 new file mode 100644 index 000000000000..f56c5354077d --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python3_package.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2024-10-23/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 8498d7f90ae6..f1c45a20a5a5 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 @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.runbook.create_or_update( @@ -50,7 +50,8 @@ def main(): }, "uri": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1", }, - "runbookType": "PowerShellWorkflow", + "runbookType": "PowerShell", + "runtimeEnvironment": "environmentName", }, "tags": {"tag01": "value01", "tag02": "value02"}, }, @@ -58,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/createOrUpdateRunbook.json +# x-ms-original-file: 2024-10-23/runbook/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 719652b771ee..9cf9f6c5db7d 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.schedule.create_or_update( @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createOrUpdateSchedule.json +# x-ms-original-file: 2024-10-23/createOrUpdateSchedule.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/create_or_update_source_control.py similarity index 85% rename from sdk/automation/azure-mgmt-automation/generated_samples/source_control/create_or_update_source_control.py rename to sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_source_control.py index 201cbb66cf35..d50a9a4c9b41 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/create_or_update_source_control.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.source_control.create_or_update( @@ -51,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/sourceControl/createOrUpdateSourceControl.json +# x-ms-original-file: 2024-10-23/sourceControl/createOrUpdateSourceControl.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 06271a544af6..2a674cfab9eb 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.variable.create_or_update( @@ -43,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createOrUpdateVariable.json +# x-ms-original-file: 2024-10-23/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 4682106957c7..026c0dcb49fb 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.watcher.create_or_update( @@ -38,13 +37,10 @@ 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", @@ -56,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createOrUpdateWatcher.json +# x-ms-original-file: 2024-10-23/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 1659da64c40e..5a680dc95e40 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.webhook.create_or_update( @@ -48,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/createOrUpdateWebhook.json +# x-ms-original-file: 2024-10-23/createOrUpdateWebhook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_runbook_as_draft.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_runbook_as_draft.py index 27b929513731..4403dcf01152 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.runbook.create_or_update( @@ -43,7 +42,8 @@ def main(): "draft": {}, "logProgress": False, "logVerbose": False, - "runbookType": "PowerShellWorkflow", + "runbookType": "PowerShell", + "runtimeEnvironment": "environmentName", }, "tags": {"tag01": "value01", "tag02": "value02"}, }, @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/createRunbookAsDraft.json +# x-ms-original-file: 2024-10-23/runbook/createRunbookAsDraft.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_runtime_environment.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_runtime_environment.py new file mode 100644 index 000000000000..af1054d3f9b2 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_runtime_environment.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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_runtime_environment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info 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.runtime_environments.create( + resource_group_name="rg", + automation_account_name="myAutomationAccount9", + runtime_environment_name="myRuntimeEnvironmentName", + parameters={ + "location": "East US 2", + "properties": { + "defaultPackages": {"Az": "12.3.0"}, + "runtime": {"language": "PowerShell", "version": "7.4"}, + }, + }, + ) + print(response) + + +# x-ms-original-file: 2024-10-23/runtimeEnvironment/createRuntimeEnvironment.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/create_software_update_configuration.py similarity index 87% rename from sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/create_software_update_configuration.py rename to sdk/automation/azure-mgmt-automation/generated_samples/create_software_update_configuration.py index 6df39a280363..cbebb46da076 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/create_software_update_configuration.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.software_update_configurations.create( @@ -68,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"], + }, }, } ], @@ -92,6 +92,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfiguration/createSoftwareUpdateConfiguration.json +# x-ms-original-file: 2024-10-23/softwareUpdateConfiguration/createSoftwareUpdateConfiguration.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/create_source_control_sync_job.py similarity index 82% rename from sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/create_source_control_sync_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/create_source_control_sync_job.py index 995875b4ef1f..e08704c26c62 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/create_source_control_sync_job.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.source_control_sync_job.create( @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/sourceControlSyncJob/createSourceControlSyncJob.json +# x-ms-original-file: 2024-10-23/sourceControlSyncJob/createSourceControlSyncJob.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 c268eed04fb2..87b9c69ba5dd 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,18 +27,22 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.test_job.create( resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", - parameters={"parameters": {"key01": "value01", "key02": "value02"}, "runOn": ""}, + parameters={ + "parameters": {"key01": "value01", "key02": "value02"}, + "runOn": "", + "runtimeEnvironment": "runtimeEnvironmentName", + }, ) print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/createTestJob.json +# x-ms-original-file: 2024-10-23/runbook/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 a77a254845ae..c454ae7eb3f9 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.automation_account.delete( @@ -37,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteAutomationAccount.json +# x-ms-original-file: 2024-10-23/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 a40f6dd90b2c..e7837bec15ab 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_certificate.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.certificate.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteCertificate.json +# x-ms-original-file: 2024-10-23/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 db5ba6219166..aa39ba603fa6 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,17 +27,16 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.connection.delete( + client.connection.delete( resource_group_name="rg", automation_account_name="myAutomationAccount28", connection_name="myConnection", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteConnection.json +# x-ms-original-file: 2024-10-23/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 28e43890669a..cbc31d2392dd 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.connection_type.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteConnectionType.json +# x-ms-original-file: 2024-10-23/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 8e277657bbbc..c5128181110d 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.credential.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteCredentialExisting.json +# x-ms-original-file: 2024-10-23/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 6e26711363fd..bb0a5ffbdc39 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.dsc_configuration.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteDscConfiguration.json +# x-ms-original-file: 2024-10-23/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 ea9a51c35b07..e3504f845ffd 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,17 +27,16 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.dsc_node.delete( + client.dsc_node.delete( resource_group_name="rg", automation_account_name="myAutomationAccount9", node_id="e1243a76-a9bd-432f-bde3-ad8f317ee786", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/deleteDscNode.json +# x-ms-original-file: 2024-10-23/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 fa28096c1888..0a5f7d5a3275 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.dsc_node_configuration.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/deleteDscNodeConfiguration.json +# x-ms-original-file: 2024-10-23/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 new file mode 100644 index 000000000000..4bf6a6fc9a38 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2024-10-23/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 517b9e4298cb..547cab6e71f2 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.hybrid_runbook_worker_group.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteHybridRunbookWorkerGroup.json +# x-ms-original-file: 2024-10-23/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 22c69ad6b4ca..29ab667314a0 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.job_schedule.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteJobSchedule.json +# x-ms-original-file: 2024-10-23/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 a42c42ce444a..cb95b7046220 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_module.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.module.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteModule.json +# x-ms-original-file: 2024-10-23/deleteModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_package.py new file mode 100644 index 000000000000..179e7458769c --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_package.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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_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="SUBSCRIPTION_ID", + ) + + client.package.delete( + resource_group_name="rg", + automation_account_name="myAutomationAccount33", + runtime_environment_name="runtimeEnvironmentName", + package_name="OmsCompositeResources", + ) + + +# x-ms-original-file: 2024-10-23/package/deletePackage.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 117f5f05dbf6..014dfe93b2d9 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.python2_package.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/deletePython2Package.json +# x-ms-original-file: 2024-10-23/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 new file mode 100644 index 000000000000..6c31b23d8393 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_python3_package.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + client.python3_package.delete( + resource_group_name="rg", + automation_account_name="myAutomationAccount33", + package_name="OmsCompositeResources", + ) + + +# x-ms-original-file: 2024-10-23/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 6749a3dbe9c4..8510d90e213e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_runbook.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.runbook.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/deleteRunbook.json +# x-ms-original-file: 2024-10-23/runbook/deleteRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_runtime_environment.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_runtime_environment.py new file mode 100644 index 000000000000..5f846f0cc5b2 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_runtime_environment.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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_runtime_environment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info 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", + ) + + client.runtime_environments.delete( + resource_group_name="rg", + automation_account_name="myAutomationAccount9", + runtime_environment_name="myRuntimeEnvironmentName", + ) + + +# x-ms-original-file: 2024-10-23/runtimeEnvironment/deleteRuntimeEnvironment.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 3999c134eedd..88f116882a6d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_schedule.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.schedule.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteSchedule.json +# x-ms-original-file: 2024-10-23/deleteSchedule.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/delete_software_update_configuration.py similarity index 78% rename from sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/delete_software_update_configuration.py rename to sdk/automation/azure-mgmt-automation/generated_samples/delete_software_update_configuration.py index 716a83fe463b..30291bb2bcde 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/delete_software_update_configuration.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) client.software_update_configurations.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfiguration/deleteSoftwareUpdateConfiguration.json +# x-ms-original-file: 2024-10-23/softwareUpdateConfiguration/deleteSoftwareUpdateConfiguration.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/delete_source_control.py similarity index 81% rename from sdk/automation/azure-mgmt-automation/generated_samples/source_control/delete_source_control.py rename to sdk/automation/azure-mgmt-automation/generated_samples/delete_source_control.py index fc4ca6877482..ed90e4732fd0 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/delete_source_control.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_source_control.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.source_control.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/sourceControl/deleteSourceControl.json +# x-ms-original-file: 2024-10-23/sourceControl/deleteSourceControl.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 56e4aabc35ea..ca2c769eb990 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_variable.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_variable.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.variable.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteVariable.json +# x-ms-original-file: 2024-10-23/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 46e64ab63b90..4864942826be 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_watcher.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.watcher.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteWatcher.json +# x-ms-original-file: 2024-10-23/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 8887133895f1..3ca612845d1a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_webhook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_webhook.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.webhook.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteWebhook.json +# x-ms-original-file: 2024-10-23/deleteWebhook.json if __name__ == "__main__": main() 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/deserialize_graph_runbook_content.py similarity index 65% rename from sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_by_job_stream_id.py rename to sdk/automation/azure-mgmt-automation/generated_samples/deserialize_graph_runbook_content.py index 34ded308b8e8..456deee2fc72 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/deserialize_graph_runbook_content.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-automation # USAGE - python compilation_job_stream_by_job_stream_id.py + 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, @@ -28,18 +28,23 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.dsc_compilation_job.get_stream( + response = client.convert_graph_runbook_content( resource_group_name="rg", - automation_account_name="myAutomationAccount33", - job_id="836d4e06-2d88-46b4-8500-7febd4906838", - job_stream_id="836d4e06-2d88-46b4-8500-7febd4906838_00636481062421684835_00000000000000000008", + 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/2018-01-15/examples/compilationJobStreamByJobStreamId.json +# x-ms-original-file: 2024-10-23/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 42139690ba31..0f0763459da3 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.activity.get( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getActivityInAModule.json +# x-ms-original-file: 2024-10-23/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 5b9766469243..83b9e8b46dd5 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.agent_registration_information.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/getAgentRegistration.json +# x-ms-original-file: 2024-10-23/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 948e2aef6b15..998a3a7a5bdc 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.connection_type.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getAllConnectionTypes_First100.json +# x-ms-original-file: 2024-10-23/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 2edc93a90bed..6f2b30e428a7 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.connection_type.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getAllConnectionTypes_Next100.json +# x-ms-original-file: 2024-10-23/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 fe7fbe7e9e5c..4702459da32d 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_configuration.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getAllDscConfigurations.json +# x-ms-original-file: 2024-10-23/getAllDscConfigurations.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/get_all_source_control_sync_jobs.py similarity index 81% rename from sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_all_source_control_sync_jobs.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_control_sync_jobs.py index be6bd434b88a..01f9a444d9be 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/get_all_source_control_sync_jobs.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.source_control_sync_job.list_by_automation_account( @@ -40,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/sourceControlSyncJob/getAllSourceControlSyncJobs.json +# x-ms-original-file: 2024-10-23/sourceControlSyncJob/getAllSourceControlSyncJobs.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/get_all_source_controls.py similarity index 81% rename from sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_all_source_controls.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_controls.py index 78a93c799308..3a410a5424ad 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_all_source_controls.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_controls.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.source_control.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/sourceControl/getAllSourceControls.json +# x-ms-original-file: 2024-10-23/sourceControl/getAllSourceControls.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 30c9ea0a771a..d7424749ae62 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.automation_account.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getAutomationAccount.json +# x-ms-original-file: 2024-10-23/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 54d30999585e..982c5448d6ea 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_certificate.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.certificate.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getCertificate.json +# x-ms-original-file: 2024-10-23/getCertificate.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py index 98e156118321..6f2a0e8d9b41 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.connection.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getConnection.json +# x-ms-original-file: 2024-10-23/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 d5f5c947f712..8467618effb6 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.connection_type.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getConnectionType.json +# x-ms-original-file: 2024-10-23/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 2a996d3a5f56..95961c629a09 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_credential.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_credential.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.credential.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getCredential.json +# x-ms-original-file: 2024-10-23/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 new file mode 100644 index 000000000000..2dff2a42e32f --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_deleted_automation_account.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + response = client.deleted_automation_accounts.list_by_subscription() + print(response) + + +# x-ms-original-file: 2024-10-23/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 59eb1060a128..8fe80741add4 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_configuration.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getDscConfiguration.json +# x-ms-original-file: 2024-10-23/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 549586900c7b..f0cb7ccf8b83 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_configuration.get_content( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getDscConfigurationContent.json +# x-ms-original-file: 2024-10-23/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 51d0e3d4165f..8222d7549f82 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/getDscNode.json +# x-ms-original-file: 2024-10-23/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 2bb783117c0e..161b7394b06f 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node_configuration.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/getDscNodeConfiguration.json +# x-ms-original-file: 2024-10-23/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 772ed7dbdffd..6738a22c3496 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_reports.get( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/getDscNodeReport.json +# x-ms-original-file: 2024-10-23/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 4390782ec545..b2cb6e856583 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_reports.get_content( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/getDscNodeReportContent.json +# x-ms-original-file: 2024-10-23/getDscNodeReportContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py new file mode 100644 index 000000000000..045db6a86d00 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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_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="SUBSCRIPTION_ID", + ) + + response = client.hybrid_runbook_workers.get( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_id="c010ad12-ef14-4a2a-aa9e-ef22c4745ddd", + ) + print(response) + + +# x-ms-original-file: 2024-10-23/getHybridRunbookWorker.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_get.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py similarity index 79% rename from sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_get.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py index 6200c6a970a8..49b9093bff6b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_get.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -16,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-automation # USAGE - python hybrid_runbook_worker_group_get.py + python get_hybrid_runbook_worker_group.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.hybrid_runbook_worker_group.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/hybridRunbookWorkerGroupGet.json +# x-ms-original-file: 2024-10-23/getHybridRunbookWorkerGroup.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/get_job.py similarity index 80% rename from sdk/automation/azure-mgmt-automation/generated_samples/job/get_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_job.py index decb4dfb512a..8acc351609d3 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_job.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.job.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/job/getJob.json +# x-ms-original-file: 2024-10-23/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/get_job_output.py similarity index 80% rename from sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_output.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_job_output.py index dfc06c07342d..18911579b302 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_output.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_job_output.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.job.get_output( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/job/getJobOutput.json +# x-ms-original-file: 2024-10-23/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/get_job_runbook_content.py similarity index 80% rename from sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_runbook_content.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_job_runbook_content.py index b92b946cb9f1..980c699f17fc 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_runbook_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_job_runbook_content.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.job.get_runbook_content( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/job/getJobRunbookContent.json +# x-ms-original-file: 2024-10-23/job/getJobRunbookContent.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 c9739caad7d6..426c797d338b 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.job_schedule.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getJobSchedule.json +# x-ms-original-file: 2024-10-23/getJobSchedule.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/get_job_stream.py similarity index 81% rename from sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_stream.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_job_stream.py index dd52cbb1a3f2..130755073923 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_stream.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_job_stream.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.job_stream.get( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/job/getJobStream.json +# x-ms-original-file: 2024-10-23/job/getJobStream.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 d51a1e820351..88cebb6d28ec 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.linked_workspace.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getLinkedWorkspace.json +# x-ms-original-file: 2024-10-23/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 6d49ef8ee537..277cf8b4816c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_module.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.module.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getModule.json +# x-ms-original-file: 2024-10-23/getModule.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_package.py similarity index 74% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_compilation_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_package.py index 21663d3b55d8..07c9a3812ec4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_compilation_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_package.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -16,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-automation # USAGE - python get_compilation_job.py + python get_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, @@ -28,17 +27,18 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.dsc_compilation_job.get( + response = client.package.get( resource_group_name="rg", automation_account_name="myAutomationAccount33", - compilation_job_name="TestCompilationJob", + runtime_environment_name="runtimeEnvironmentName", + package_name="OmsCompositeResources", ) print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/getCompilationJob.json +# x-ms-original-file: 2024-10-23/package/getPackage.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 66e5a73b7f55..50981cb85687 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_configuration.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getPagedDscConfigurationsWithNoFilter.json +# x-ms-original-file: 2024-10-23/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 383436716971..b14e8f5977af 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_configuration.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getPagedlDscConfigurationsWithNameFilter.json +# x-ms-original-file: 2024-10-23/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 a26a60cb2d42..1cd674c3e23b 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.python2_package.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/getPython2Package.json +# x-ms-original-file: 2024-10-23/getPython2Package.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/get_python3_package.py similarity index 73% rename from sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_list.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_python3_package.py index 8e6b8c5929be..985bc8c6f632 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/compilation_job_stream_list.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_python3_package.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -16,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-automation # USAGE - python compilation_job_stream_list.py + 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, @@ -28,17 +27,17 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.dsc_compilation_job_stream.list_by_job( + response = client.python3_package.get( resource_group_name="rg", automation_account_name="myAutomationAccount33", - job_id="836d4e06-2d88-46b4-8500-7febd4906838", + package_name="OmsCompositeResources", ) print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/compilationJobStreamList.json +# x-ms-original-file: 2024-10-23/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 323b08bf6951..597c1d458928 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.runbook.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/getRunbook.json +# x-ms-original-file: 2024-10-23/runbook/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 dab881dd20a5..e3c50899defb 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.runbook.get_content( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/getRunbookContent.json +# x-ms-original-file: 2024-10-23/runbook/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 54780df84ed5..158988d6eec2 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.runbook_draft.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/getRunbookDraft.json +# x-ms-original-file: 2024-10-23/runbook/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 82a800638062..9b53198dfa0a 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.runbook_draft.get_content( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/getRunbookDraftContent.json +# x-ms-original-file: 2024-10-23/runbook/getRunbookDraftContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_runtime_environment.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_runtime_environment.py new file mode 100644 index 000000000000..bd43434e8615 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_runtime_environment.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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_runtime_environment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info 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.runtime_environments.get( + resource_group_name="rg", + automation_account_name="myAutomationAccount9", + runtime_environment_name="myRuntimeEnvironmentName", + ) + print(response) + + +# x-ms-original-file: 2024-10-23/runtimeEnvironment/getRuntimeEnvironment.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 0ffaca3bb372..254296030281 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_schedule.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.schedule.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getSchedule.json +# x-ms-original-file: 2024-10-23/getSchedule.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/get_software_update_configuration_by_name.py similarity index 79% rename from sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/get_software_update_configuration_by_name.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_by_name.py index ada04f3b8ab9..1ed250eceaff 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/get_software_update_configuration_by_name.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.software_update_configurations.get_by_name( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfiguration/getSoftwareUpdateConfigurationByName.json +# x-ms-original-file: 2024-10-23/softwareUpdateConfiguration/getSoftwareUpdateConfigurationByName.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/get_software_update_configuration_machine_run_by_id.py similarity index 79% rename from sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/get_software_update_configuration_machine_run_by_id.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_machine_run_by_id.py index 37d3a1c56136..13338cd486f9 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/get_software_update_configuration_machine_run_by_id.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.software_update_configuration_machine_runs.get_by_id( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfigurationMachineRun/getSoftwareUpdateConfigurationMachineRunById.json +# x-ms-original-file: 2024-10-23/softwareUpdateConfigurationMachineRun/getSoftwareUpdateConfigurationMachineRunById.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/get_software_update_configuration_run_by_id.py similarity index 79% rename from sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/get_software_update_configuration_run_by_id.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_run_by_id.py index c7558a186bfe..62e78a532dbe 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/get_software_update_configuration_run_by_id.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.software_update_configuration_runs.get_by_id( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfigurationRun/getSoftwareUpdateConfigurationRunById.json +# x-ms-original-file: 2024-10-23/softwareUpdateConfigurationRun/getSoftwareUpdateConfigurationRunById.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/get_source_control.py similarity index 81% rename from sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_source_control.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_source_control.py index a0711f4dad28..54f89e380c8c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_source_control.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.source_control.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/sourceControl/getSourceControl.json +# x-ms-original-file: 2024-10-23/sourceControl/getSourceControl.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/get_source_control_sync_job.py similarity index 82% rename from sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_source_control_sync_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job.py index a599ed888af5..98d3aefe2427 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/get_source_control_sync_job.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.source_control_sync_job.get( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/sourceControlSyncJob/getSourceControlSyncJob.json +# x-ms-original-file: 2024-10-23/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/get_source_control_sync_job_streams.py similarity index 82% rename from sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams.py index 319e5faef95e..d7779bdc05d4 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/get_source_control_sync_job_streams.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.source_control_sync_job_streams.list_by_sync_job( @@ -41,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/sourceControlSyncJobStreams/getSourceControlSyncJobStreams.json +# x-ms-original-file: 2024-10-23/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/get_source_control_sync_job_streams_by_stream_id.py similarity index 82% rename from sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams_by_stream_id.py rename to sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams_by_stream_id.py index 65e7e8053a54..8aca374fc515 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/get_source_control_sync_job_streams_by_stream_id.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.source_control_sync_job_streams.get( @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/sourceControlSyncJobStreams/getSourceControlSyncJobStreamsByStreamId.json +# x-ms-original-file: 2024-10-23/sourceControlSyncJobStreams/getSourceControlSyncJobStreamsByStreamId.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 096dc2a29d29..e7f8941e35e2 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.statistics.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getStatisticsOfAutomationAccount.json +# x-ms-original-file: 2024-10-23/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 788facda64ca..e27ee1edb5b7 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.test_job.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/getTestJob.json +# x-ms-original-file: 2024-10-23/runbook/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 b90b0305a996..f1fdce6b0e68 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.test_job_streams.get( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/getTestJobStream.json +# x-ms-original-file: 2024-10-23/runbook/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 fba0e9496cdc..a35b2fc8d054 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.usages.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getUsagesOfAutomationAccount.json +# x-ms-original-file: 2024-10-23/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 8f093f019bd7..6396a58690ed 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_variable.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_variable.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.variable.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getVariable.json +# x-ms-original-file: 2024-10-23/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 3c7306f47ede..c2d37804259f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_watcher.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.watcher.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getWatcher.json +# x-ms-original-file: 2024-10-23/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 6202e7508281..41aefe53bc29 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_webhook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_webhook.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.webhook.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getWebhook.json +# x-ms-original-file: 2024-10-23/getWebhook.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 ac8ca4d6d7b6..aebe64dc116e 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.activity.list_by_module( @@ -40,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listActivitiesByModule.json +# x-ms-original-file: 2024-10-23/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 eb1c93a35954..1b35dc7d8932 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listAllDscNodesByAutomationAccount.json +# x-ms-original-file: 2024-10-23/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 be59634202d7..52c1f7f34483 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.job_schedule.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listAllJobSchedulesByAutomationAccount.json +# x-ms-original-file: 2024-10-23/listAllJobSchedulesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_deleted_runbooks.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_deleted_runbooks.py new file mode 100644 index 000000000000..27c460db5a1d --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_deleted_runbooks.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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_automation_account_deleted_runbooks.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info 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.automation_account.list_deleted_runbooks( + resource_group_name="rg", + automation_account_name="MyAutomationAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-10-23/listAutomationAccountDeletedRunbooks.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 dd20c0a8218d..3c05a4c50cfe 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.keys.list_by_automation_account( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listAutomationAccountKeys.json +# x-ms-original-file: 2024-10-23/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 f044a5b90c12..6f60701438d2 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.automation_account.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listAutomationAccountsByResourceGroup.json +# x-ms-original-file: 2024-10-23/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 acd926a98d0c..8d154c542eb1 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.automation_account.list() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listAutomationAccountsBySubscription.json +# x-ms-original-file: 2024-10-23/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 5cc0e0457130..626bff05f7af 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.certificate.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listCertificatesByAutomationAccount.json +# x-ms-original-file: 2024-10-23/listCertificatesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_first100.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_first100.py index c96dd9b406dc..a80e7a879ca6 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.connection.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listConnectionsByAutomationAccount_First100.json +# x-ms-original-file: 2024-10-23/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 9e6c8be08513..1f1be7f3c6ea 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.connection.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listConnectionsByAutomationAccount_Next100.json +# x-ms-original-file: 2024-10-23/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 c865397200ce..01836f2531ef 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.credential.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listCredentialsByAutomationAccount.json +# x-ms-original-file: 2024-10-23/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 5cbfa402a1d0..def0560f1f4b 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.credential.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listCredentialsByAutomationAccount_next100_using_nextLink.json +# x-ms-original-file: 2024-10-23/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 9e576119e164..f0beac62ba0a 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node_configuration.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listDscNodeConfigurations.json +# x-ms-original-file: 2024-10-23/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 38d33268b9a0..39edfb6f47ea 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_reports.list_by_node( @@ -40,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listDscNodeReportsByNode.json +# x-ms-original-file: 2024-10-23/listDscNodeReportsByNode.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/list_failed_software_update_configuration_runs.py similarity index 78% rename from sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_failed_software_update_configuration_runs.py rename to sdk/automation/azure-mgmt-automation/generated_samples/list_failed_software_update_configuration_runs.py index 3a28d065005d..abb267331668 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/list_failed_software_update_configuration_runs.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.software_update_configuration_runs.list( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfigurationRun/listFailedSoftwareUpdateConfigurationRuns.json +# x-ms-original-file: 2024-10-23/softwareUpdateConfigurationRun/listFailedSoftwareUpdateConfigurationRuns.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 7db1d94ae565..97e2eebfec68 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,10 +27,10 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.object_data_types.list_fields_by_module_and_type( + response = client.fields.list_by_type( resource_group_name="rg", automation_account_name="MyAutomationAccount", module_name="MyModule", @@ -41,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listFieldsByModuleAndType.json +# x-ms-original-file: 2024-10-23/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 4473dec0fdfc..57188465f5a3 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.object_data_types.list_fields_by_type( @@ -40,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listFieldsByType.json +# x-ms-original-file: 2024-10-23/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 new file mode 100644 index 000000000000..a5ff6dd92fb1 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2024-10-23/listHybridRunbookWorker.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_list.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker_group.py similarity index 77% rename from sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_list.py rename to sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker_group.py index 968300eb1a81..185a0a2c5723 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_list.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -16,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-automation # USAGE - python hybrid_runbook_worker_group_list.py + python list_hybrid_runbook_worker_group.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,17 +27,17 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.hybrid_runbook_worker_group.list_by_automation_account( - resource_group_name="udtest", + resource_group_name="rg", automation_account_name="testaccount", ) for item in response: print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/hybridRunbookWorkerGroupList.json +# x-ms-original-file: 2024-10-23/listHybridRunbookWorkerGroup.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/list_job_streams_by_job.py similarity index 80% rename from sdk/automation/azure-mgmt-automation/generated_samples/job/list_job_streams_by_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/list_job_streams_by_job.py index 7f9aad840e78..a464f45c36ac 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/list_job_streams_by_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_job_streams_by_job.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.job_stream.list_by_job( @@ -40,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/job/listJobStreamsByJob.json +# x-ms-original-file: 2024-10-23/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/list_jobs_by_automation_account.py similarity index 76% rename from sdk/automation/azure-mgmt-automation/generated_samples/job/list_jobs_by_automation_account.py rename to sdk/automation/azure-mgmt-automation/generated_samples/list_jobs_by_automation_account.py index a785965c8438..46c20666fc71 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/list_jobs_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_jobs_by_automation_account.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.job.list_by_automation_account( resource_group_name="mygroup", - automation_account_name="ContoseAutomationAccount", + automation_account_name="ContosoAutomationAccount", ) for item in response: print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/job/listJobsByAutomationAccount.json +# x-ms-original-file: 2024-10-23/job/listJobsByAutomationAccount.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 e6fb65308ca7..f1e721dc0664 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.module.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listModulesByAutomationAccount.json +# x-ms-original-file: 2024-10-23/listModulesByAutomationAccount.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_packages_by_runtime_environment.py similarity index 74% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_compilation_jobs_by_automation_account.py rename to sdk/automation/azure-mgmt-automation/generated_samples/list_packages_by_runtime_environment.py index e69bfc2bb6d9..84858ab3d721 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_packages_by_runtime_environment.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -16,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-automation # USAGE - python list_compilation_jobs_by_automation_account.py + python list_packages_by_runtime_environment.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,17 +27,18 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.dsc_compilation_job.list_by_automation_account( + response = client.package.list_by_runtime_environment( resource_group_name="rg", automation_account_name="myAutomationAccount33", + runtime_environment_name="runtimeEnvironmentName", ) for item in response: print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listCompilationJobsByAutomationAccount.json +# x-ms-original-file: 2024-10-23/package/listPackagesByRuntimeEnvironment.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 e72e5db1e191..034b96b6692d 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_count_information.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodeConfigurationCounts.json +# x-ms-original-file: 2024-10-23/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 f91556dbfbb2..106e6b04f996 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node_configuration.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodeConfigurationsWithNameFilter.json +# x-ms-original-file: 2024-10-23/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 c9efc220c133..af1acefd1b34 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node_configuration.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodeConfigurationsWithNoFilter.json +# x-ms-original-file: 2024-10-23/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 new file mode 100644 index 000000000000..6ed0040c00c7 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_reports_by_node.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2024-10-23/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 41713f261711..9a1629ad213a 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_count_information.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodeStatusCounts.json +# x-ms-original-file: 2024-10-23/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 ef074e32959a..71f72002ecd9 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithCompositeFilter.json +# x-ms-original-file: 2024-10-23/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 e1f94d3cc998..7591ac204719 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithNameFilter.json +# x-ms-original-file: 2024-10-23/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 22ec32878443..e00dcdb861d4 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithNoFilter.json +# x-ms-original-file: 2024-10-23/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 37e5452491df..f482e5e30cc9 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithNodeConfigurationCustomFilter.json +# x-ms-original-file: 2024-10-23/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 738d16291a6f..b6071d0be0f4 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithNodeConfigurationNotAssignedFilter.json +# x-ms-original-file: 2024-10-23/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 46e5a6bdd4a8..3ad8e7922fce 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithStatusFilter.json +# x-ms-original-file: 2024-10-23/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 5cc375196659..45863b9563ad 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/listPagedDscNodesByAutomationAccountWithVersionFilter.json +# x-ms-original-file: 2024-10-23/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 d77b27763195..daa4a000fa15 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.python2_package.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/listPython2PackagesByAutomationAccount.json +# x-ms-original-file: 2024-10-23/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 new file mode 100644 index 000000000000..c808841f7c5b --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_python3_packages_by_automation_account.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2024-10-23/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 new file mode 100644 index 000000000000..5e20f9984bdf --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_rest_api_operations.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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: 2024-10-23/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 a404bc33250f..534b9bd218d9 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.runbook.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/listRunbooksByAutomationAccount.json +# x-ms-original-file: 2024-10-23/runbook/listRunbooksByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_runtime_environments_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_runtime_environments_by_automation_account.py new file mode 100644 index 000000000000..5fa30b443427 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_runtime_environments_by_automation_account.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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_runtime_environments_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="SUBSCRIPTION_ID", + ) + + response = client.runtime_environments.list_by_automation_account( + resource_group_name="rg", + automation_account_name="ContoseAutomationAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-10-23/runtimeEnvironment/listRuntimeEnvironmentsByAutomationAccount.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 9e63726471aa..214b18fda584 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.schedule.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listSchedulesByAutomationAccount_First100.json +# x-ms-original-file: 2024-10-23/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 a61fbf59d017..6924d11488ec 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.schedule.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listSchedulesByAutomationAccount_Next100.json +# x-ms-original-file: 2024-10-23/listSchedulesByAutomationAccount_Next100.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/list_software_update_configuration_machine_runs.py similarity index 78% rename from sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs.py rename to sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs.py index 0bf99ed805fa..c36c6e0bfc0f 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/list_software_update_configuration_machine_runs.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.software_update_configuration_machine_runs.list( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfigurationMachineRun/listSoftwareUpdateConfigurationMachineRuns.json +# x-ms-original-file: 2024-10-23/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/list_software_update_configuration_machine_runs_by_run.py similarity index 80% rename from sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs_by_run.py rename to sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs_by_run.py index 9e3a7e056be1..62a925fb40a0 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/list_software_update_configuration_machine_runs_by_run.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.software_update_configuration_machine_runs.list( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfigurationMachineRun/listSoftwareUpdateConfigurationMachineRunsByRun.json +# x-ms-original-file: 2024-10-23/softwareUpdateConfigurationMachineRun/listSoftwareUpdateConfigurationMachineRunsByRun.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/list_software_update_configuration_runs.py similarity index 78% rename from sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_software_update_configuration_runs.py rename to sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_runs.py index 1ac8ec83f171..757d3b0ba37f 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/list_software_update_configuration_runs.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.software_update_configuration_runs.list( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfigurationRun/listSoftwareUpdateConfigurationRuns.json +# x-ms-original-file: 2024-10-23/softwareUpdateConfigurationRun/listSoftwareUpdateConfigurationRuns.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/list_software_update_configurations.py similarity index 78% rename from sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations.py rename to sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configurations.py index e98dbede8ed0..5be6ae1629c4 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/list_software_update_configurations.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="1a7d4044-286c-4acb-969a-96639265bf2e", + subscription_id="SUBSCRIPTION_ID", ) response = client.software_update_configurations.list( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfiguration/listSoftwareUpdateConfigurations.json +# x-ms-original-file: 2024-10-23/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/list_software_update_configurations_by_vm.py similarity index 78% rename from sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations_by_vm.py rename to sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configurations_by_vm.py index 3e14d3559dea..32e0c6fd3181 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/list_software_update_configurations_by_vm.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="1a7d4044-286c-4acb-969a-96639265bf2e", + subscription_id="SUBSCRIPTION_ID", ) response = client.software_update_configurations.list( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/softwareUpdateConfiguration/listSoftwareUpdateConfigurationsByVm.json +# x-ms-original-file: 2024-10-23/softwareUpdateConfiguration/listSoftwareUpdateConfigurationsByVm.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 f102d954ab29..ed007e136551 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) response = client.test_job_streams.list_by_test_job( @@ -40,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/listTestJobStreamsByJob.json +# x-ms-original-file: 2024-10-23/runbook/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 f81fbfe3acc4..4eaef575e6e4 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.variable.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listVariables_First100.json +# x-ms-original-file: 2024-10-23/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 0fae595bd585..5d0ea345b4d2 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.variable.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listVariables_Next100.json +# x-ms-original-file: 2024-10-23/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 0eae088ea88d..0d18aad948ba 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.watcher.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listWatchersByAutomationAccount.json +# x-ms-original-file: 2024-10-23/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 468008f3d584..d6ee1f7f5d32 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.webhook.list_by_automation_account( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/listWebhooksByAutomationAccount.json +# x-ms-original-file: 2024-10-23/listWebhooksByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/move_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/move_hybrid_runbook_worker.py new file mode 100644 index 000000000000..82bab0111027 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/move_hybrid_runbook_worker.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python move_hybrid_runbook_worker.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.hybrid_runbook_workers.move( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_id="c010ad12-ef14-4a2a-aa9e-ef22c4745ddd", + hybrid_runbook_worker_move_parameters={"hybridRunbookWorkerGroupName": "TestHybridGroup2"}, + ) + + +# x-ms-original-file: 2024-10-23/moveHybridRunbookWorker.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/object_data_typeslist_fields_by_module_and_type.py b/sdk/automation/azure-mgmt-automation/generated_samples/object_data_typeslist_fields_by_module_and_type.py new file mode 100644 index 000000000000..d4c000fc16fc --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/object_data_typeslist_fields_by_module_and_type.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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 object_data_typeslist_fields_by_module_and_type.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info 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.object_data_types.list_fields_by_module_and_type( + resource_group_name="rg", + automation_account_name="MyAutomationAccount", + module_name="MyModule", + type_name="MyCustomType", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-10-23/ObjectDataTypeslistFieldsByModuleAndType.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/patch_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/patch_hybrid_runbook_worker.py new file mode 100644 index 000000000000..51d8600ca2aa --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/patch_hybrid_runbook_worker.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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 patch_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="SUBSCRIPTION_ID", + ) + + response = client.hybrid_runbook_workers.patch( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_id="c010ad12-ef14-4a2a-aa9e-ef22c4745ddd", + ) + print(response) + + +# x-ms-original-file: 2024-10-23/patchHybridRunbookWorker.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_delete.py b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_delete.py new file mode 100644 index 000000000000..eeb8122674c4 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + client.private_endpoint_connections.begin_delete( + resource_group_name="rg1", + automation_account_name="automationAccountName", + private_endpoint_connection_name="privateEndpointConnectionName", + ).result() + + +# x-ms-original-file: 2024-10-23/privateEndpointConnection/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 new file mode 100644 index 000000000000..7f43dafb6cbf --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + response = client.private_endpoint_connections.get( + resource_group_name="rg1", + automation_account_name="automationAccountName", + private_endpoint_connection_name="privateEndpointConnectionName", + ) + print(response) + + +# x-ms-original-file: 2024-10-23/privateEndpointConnection/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 new file mode 100644 index 000000000000..37e95cbee4c8 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_list_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + response = client.private_endpoint_connections.list_by_automation_account( + resource_group_name="rg1", + automation_account_name="automationAccountName", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-10-23/privateEndpointConnection/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 new file mode 100644 index 000000000000..f39b8bf8006a --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_update.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + response = client.private_endpoint_connections.begin_create_or_update( + resource_group_name="rg1", + automation_account_name="automationAccountName", + private_endpoint_connection_name="privateEndpointConnectionName", + parameters={ + "properties": { + "privateLinkServiceConnectionState": { + "description": "Approved by `johndoe@contoso.com `_", + "status": "Approved", + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-10-23/privateEndpointConnection/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 new file mode 100644 index 000000000000..17a6a853b81a --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/private_link_resource_list_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + response = client.private_link_resources.automation( + resource_group_name="rg1", + automation_account_name="testaccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-10-23/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 2d57ddb14e1e..c0f724e74b14 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/publish_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/publish_runbook.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.runbook.begin_publish( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/publishRunbook.json +# x-ms-original-file: 2024-10-23/runbook/publishRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker.py new file mode 100644 index 000000000000..b59e2ada7e22 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker.py @@ -0,0 +1,50 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python put_hybrid_runbook_worker.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.hybrid_runbook_workers.create( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_id="c010ad12-ef14-4a2a-aa9e-ef22c4745ddd", + hybrid_runbook_worker_creation_parameters={ + "properties": { + "vmResourceId": "/subscriptions/vmsubid/resourceGroups/vmrg/providers/Microsoft.Compute/virtualMachines/vmname" + } + }, + ) + print(response) + + +# x-ms-original-file: 2024-10-23/putHybridRunbookWorker.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker_group.py new file mode 100644 index 000000000000..396c2ab20258 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker_group.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python put_hybrid_runbook_worker_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.hybrid_runbook_worker_group.create( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_group_creation_parameters={ + "properties": {"credential": {"name": "myRunAsCredentialName"}} + }, + ) + print(response) + + +# x-ms-original-file: 2024-10-23/putHybridRunbookWorkerGroup.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 a9785c8056ab..b00c01710ffa 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.agent_registration_information.regenerate_key( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/regenerateAgentRegistrationKey.json +# x-ms-original-file: 2024-10-23/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 30ad2f86932c..c1853ceb48fc 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 @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,15 +28,15 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.runbook_draft.begin_replace_content( + client.runbook_draft.begin_replace_content( resource_group_name="rg", automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", runbook_content="""<# - .DESCRIPTION + .DESCRIPTION An example runbook which prints out the first10 Azure VMs in your subscription (ordered alphabetically). For more information about how this runbook authenticates to your Azure subscription, see our documentation here: http: //aka.ms/fxu3mn @@ -76,9 +76,8 @@ def main(): } }""", ).result() - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/replaceRunbookDraftContent.json +# x-ms-original-file: 2024-10-23/runbook/replaceRunbookDraftContent.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/resume_job.py similarity index 80% rename from sdk/automation/azure-mgmt-automation/generated_samples/job/resume_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/resume_job.py index 858bac0bcfae..fb8fcd09c867 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/resume_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/resume_job.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) client.job.resume( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/job/resumeJob.json +# x-ms-original-file: 2024-10-23/job/resumeJob.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 8fbb4015c7e7..9b2c843eb3a8 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) client.test_job.resume( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/resumeTestJob.json +# x-ms-original-file: 2024-10-23/runbook/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 new file mode 100644 index 000000000000..4665222548ca --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/serialize_graph_runbook_content.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + response = client.convert_graph_runbook_content( + resource_group_name="rg", + automation_account_name="MyAutomationAccount", + parameters={"graphRunbookJson": ""}, + ) + print(response) + + +# x-ms-original-file: 2024-10-23/serializeGraphRunbookContent.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 dd232da138ce..7b3d05716709 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/start_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/start_watcher.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.watcher.start( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/startWatcher.json +# x-ms-original-file: 2024-10-23/startWatcher.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/stop_job.py similarity index 80% rename from sdk/automation/azure-mgmt-automation/generated_samples/job/stop_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/stop_job.py index 4001ee9ed891..067da45aea39 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/stop_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/stop_job.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) client.job.stop( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/job/stopJob.json +# x-ms-original-file: 2024-10-23/job/stopJob.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 06c76a13be5d..4d97c55b30da 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) client.test_job.stop( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/stopTestJob.json +# x-ms-original-file: 2024-10-23/runbook/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 f68ee6fa6f33..d54f9040961f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/stop_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/stop_watcher.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.watcher.stop( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/stopWatcher.json +# x-ms-original-file: 2024-10-23/stopWatcher.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/suspend_job.py similarity index 80% rename from sdk/automation/azure-mgmt-automation/generated_samples/job/suspend_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/suspend_job.py index 28283156eb9b..8e740903bc9c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/job/suspend_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/suspend_job.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) client.job.suspend( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/job/suspendJob.json +# x-ms-original-file: 2024-10-23/job/suspendJob.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 8ee0512ee193..384b085d4a90 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", + subscription_id="SUBSCRIPTION_ID", ) client.test_job.suspend( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/suspendTestJob.json +# x-ms-original-file: 2024-10-23/runbook/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 fa03a20da1d2..d179289ef862 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.runbook_draft.undo_edit( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/undoDraftEditToLastKnownPublishedState.json +# x-ms-original-file: 2024-10-23/runbook/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 aa75c14313ac..a786796c9f76 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.automation_account.update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/updateAutomationAccount.json +# x-ms-original-file: 2024-10-23/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 e5901f9c03e2..013a803565e1 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_certificate.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.certificate.update( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/updateCertificate.json +# x-ms-original-file: 2024-10-23/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 9f8a7da7c0f1..d77ae16e1388 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_connection.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.connection.update( @@ -49,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/updateConnection.json +# x-ms-original-file: 2024-10-23/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 972b2a00f434..2cb48176bc5a 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.credential.update( @@ -47,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/updateCredential_patch.json +# x-ms-original-file: 2024-10-23/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 8c36b093a4ee..f473ad2411ce 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_configuration.update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/updateDscConfiguration.json +# x-ms-original-file: 2024-10-23/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 f7d76584a0c3..fd6bac87e5b8 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.dsc_node.update( @@ -43,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-01-15/examples/updateDscNode.json +# x-ms-original-file: 2024-10-23/updateDscNode.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_update.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_hybrid_runbook_worker_group.py similarity index 76% rename from sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_update.py rename to sdk/automation/azure-mgmt-automation/generated_samples/update_hybrid_runbook_worker_group.py index 4027097f858c..77d5c70e7b2a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/hybrid_runbook_worker_group_update.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_hybrid_runbook_worker_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -16,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-automation # USAGE - python hybrid_runbook_worker_group_update.py + python update_hybrid_runbook_worker_group.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,18 +27,20 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.hybrid_runbook_worker_group.update( resource_group_name="rg", automation_account_name="testaccount", hybrid_runbook_worker_group_name="TestHybridGroup", - parameters={"credential": {"name": "myRunAsCredentialName"}}, + hybrid_runbook_worker_group_updation_parameters={ + "properties": {"credential": {"name": "myRunAsCredentialUpdatedName"}} + }, ) print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/hybridRunbookWorkerGroupUpdate.json +# x-ms-original-file: 2024-10-23/updateHybridRunbookWorkerGroup.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py index 800966f70aae..a3967695c644 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.module.update( @@ -51,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/updateModule.json +# x-ms-original-file: 2024-10-23/updateModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_package.py new file mode 100644 index 000000000000..b25b7a3ab570 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_package.py @@ -0,0 +1,55 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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_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="SUBSCRIPTION_ID", + ) + + response = client.package.update( + resource_group_name="rg", + automation_account_name="MyAutomationAccount", + runtime_environment_name="runtimeEnvironmentName", + package_name="OmsCompositeResources", + parameters={ + "properties": { + "contentLink": { + "contentHash": { + "algorithm": "sha265", + "value": "07E108A962B81DD9C9BAA89BB47C0F6EE52B29E83758B07795E408D258B2B87A", + }, + "uri": "https://teststorage.blob.core.windows.net/mycontainer/MyModule.zip", + } + } + }, + ) + print(response) + + +# x-ms-original-file: 2024-10-23/package/updatePackage.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 01c00c7dc620..f0c32477e476 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.python2_package.update( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/updatePython2Package.json +# x-ms-original-file: 2024-10-23/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 new file mode 100644 index 000000000000..c60d870da053 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_python3_package.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + response = client.python3_package.update( + resource_group_name="rg", + automation_account_name="MyAutomationAccount", + package_name="MyPython3Package", + parameters={"tags": {}}, + ) + print(response) + + +# x-ms-original-file: 2024-10-23/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 f5653b8c965b..8e9364db557a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_runbook.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.runbook.update( @@ -47,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/updateRunbook.json +# x-ms-original-file: 2024-10-23/runbook/updateRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_runtime_environment.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_runtime_environment.py new file mode 100644 index 000000000000..4c100b324483 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_runtime_environment.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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_runtime_environment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info 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.runtime_environments.update( + resource_group_name="rg", + automation_account_name="myAutomationAccount9", + runtime_environment_name="myRuntimeEnvironmentName", + parameters={"properties": {"defaultPackages": {"Az": "12.3.0"}}}, + ) + print(response) + + +# x-ms-original-file: 2024-10-23/runtimeEnvironment/updateRuntimeEnvironment.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 f2c93ec51faf..5d44abcf77ae 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_schedule.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.schedule.update( @@ -43,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/updateSchedule.json +# x-ms-original-file: 2024-10-23/updateSchedule.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/update_source_control_patch.py similarity index 84% rename from sdk/automation/azure-mgmt-automation/generated_samples/source_control/update_source_control_patch.py rename to sdk/automation/azure-mgmt-automation/generated_samples/update_source_control_patch.py index 7044683c1667..25d75b852b97 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/source_control/update_source_control_patch.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_source_control_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.source_control.update( @@ -49,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/examples/sourceControl/updateSourceControl_patch.json +# x-ms-original-file: 2024-10-23/sourceControl/updateSourceControl_patch.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 93197be7c21e..fb1c1097a8a7 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.variable.update( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/updateVariable_patch.json +# x-ms-original-file: 2024-10-23/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 78a9289c8d2d..24e587b9df7b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_watcher.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.watcher.update( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/updateWatcher.json +# x-ms-original-file: 2024-10-23/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 d8a1cd25df2f..32b89b827550 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_webhook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_webhook.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.webhook.update( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/updateWebhook.json +# x-ms-original-file: 2024-10-23/updateWebhook.json if __name__ == "__main__": main() 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 e77bcc86cc4a..c0e52e0f86c1 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,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AutomationClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.webhook.generate_uri( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/webhookGenerateUri.json +# x-ms-original-file: 2024-10-23/webhookGenerateUri.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/conftest.py b/sdk/automation/azure-mgmt-automation/generated_tests/conftest.py index 36f067926275..ab38fb0c821b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/conftest.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/conftest.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import os diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation.py index 156f486b72ef..57061b7a1ce9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -28,7 +28,6 @@ def test_convert_graph_runbook_content(self, resource_group): "graphRunbookJson": "str", "rawContent": {"runbookDefinition": "str", "runbookType": "str", "schemaVersion": "str"}, }, - api_version="2022-08-08", ) # please add some check logic here by yourself 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 e141812664e9..6515d87c138e 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ def test_activity_get(self, resource_group): automation_account_name="str", module_name="str", activity_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -39,7 +38,6 @@ def test_activity_list_by_module(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", module_name="str", - 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 c0be9720a467..e3cf5f2e01b6 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -27,7 +27,6 @@ async def test_activity_get(self, resource_group): automation_account_name="str", module_name="str", activity_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -40,7 +39,6 @@ async def test_activity_list_by_module(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", module_name="str", - 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 8f8b5619106d..bcc4111d516f 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ 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="2018-01-15", ) # please add some check logic here by yourself @@ -37,7 +36,6 @@ def test_agent_registration_information_regenerate_key(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", parameters={"keyName": "str"}, - 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 65a8a7f5cb11..9de797059c59 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ 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="2018-01-15", ) # please add some check logic here by yourself @@ -38,7 +37,6 @@ async def test_agent_registration_information_regenerate_key(self, resource_grou resource_group_name=resource_group.name, automation_account_name="str", parameters={"keyName": "str"}, - 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_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_async.py index 0a606eff6fb8..cc7b6328fdab 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -29,7 +29,6 @@ async def test_convert_graph_runbook_content(self, resource_group): "graphRunbookJson": "str", "rawContent": {"runbookDefinition": "str", "runbookType": "str", "schemaVersion": "str"}, }, - api_version="2022-08-08", ) # 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 883075259e02..e0218dcadcdc 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,17 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_automation_account_update(self, resource_group): - response = self.client.automation_account.update( + def test_automation_account_get(self, resource_group): + response = self.client.automation_account.get( resource_group_name=resource_group.name, automation_account_name="str", - parameters={ - "location": "str", - "name": "str", - "sku": {"name": "str", "capacity": 0, "family": "str"}, - "tags": {"str": "str"}, - }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -43,12 +36,26 @@ def test_automation_account_create_or_update(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", - "sku": {"name": "str", "capacity": 0, "family": "str"}, + "properties": { + "disableLocalAuth": bool, + "encryption": { + "identity": {"userAssignedIdentity": {}}, + "keySource": "str", + "keyVaultProperties": {"keyName": "str", "keyVersion": "str", "keyvaultUri": "str"}, + }, + "publicNetworkAccess": bool, + "sku": {"name": "str", "capacity": 0, "family": "str"}, + }, "tags": {"str": "str"}, }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -56,11 +63,31 @@ def test_automation_account_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_automation_account_delete(self, resource_group): - response = self.client.automation_account.delete( + def test_automation_account_update(self, resource_group): + response = self.client.automation_account.update( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2015-10-31", + parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "disableLocalAuth": bool, + "encryption": { + "identity": {"userAssignedIdentity": {}}, + "keySource": "str", + "keyVaultProperties": {"keyName": "str", "keyVersion": "str", "keyvaultUri": "str"}, + }, + "publicNetworkAccess": bool, + "sku": {"name": "str", "capacity": 0, "family": "str"}, + }, + "tags": {"str": "str"}, + }, ) # please add some check logic here by yourself @@ -68,11 +95,10 @@ def test_automation_account_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_automation_account_get(self, resource_group): - response = self.client.automation_account.get( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -83,7 +109,6 @@ def test_automation_account_get(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="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself @@ -92,8 +117,17 @@ def test_automation_account_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_automation_account_list(self, resource_group): - response = self.client.automation_account.list( - api_version="2015-10-31", + response = self.client.automation_account.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_automation_account_list_deleted_runbooks(self, resource_group): + response = self.client.automation_account.list_deleted_runbooks( + resource_group_name=resource_group.name, + automation_account_name="str", ) 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 a1f17325b64b..0fa42675d22a 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,17 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_automation_account_update(self, resource_group): - response = await self.client.automation_account.update( + 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", - parameters={ - "location": "str", - "name": "str", - "sku": {"name": "str", "capacity": 0, "family": "str"}, - "tags": {"str": "str"}, - }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -44,12 +37,26 @@ async def test_automation_account_create_or_update(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", - "sku": {"name": "str", "capacity": 0, "family": "str"}, + "properties": { + "disableLocalAuth": bool, + "encryption": { + "identity": {"userAssignedIdentity": {}}, + "keySource": "str", + "keyVaultProperties": {"keyName": "str", "keyVersion": "str", "keyvaultUri": "str"}, + }, + "publicNetworkAccess": bool, + "sku": {"name": "str", "capacity": 0, "family": "str"}, + }, "tags": {"str": "str"}, }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -57,11 +64,31 @@ async def test_automation_account_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_automation_account_delete(self, resource_group): - response = await self.client.automation_account.delete( + 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", - api_version="2015-10-31", + parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "disableLocalAuth": bool, + "encryption": { + "identity": {"userAssignedIdentity": {}}, + "keySource": "str", + "keyVaultProperties": {"keyName": "str", "keyVersion": "str", "keyvaultUri": "str"}, + }, + "publicNetworkAccess": bool, + "sku": {"name": "str", "capacity": 0, "family": "str"}, + }, + "tags": {"str": "str"}, + }, ) # please add some check logic here by yourself @@ -69,11 +96,10 @@ async def test_automation_account_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_automation_account_get(self, resource_group): - response = await self.client.automation_account.get( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -84,7 +110,6 @@ async def test_automation_account_get(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="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself @@ -93,8 +118,17 @@ async def test_automation_account_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_automation_account_list(self, resource_group): - response = self.client.automation_account.list( - api_version="2015-10-31", + response = self.client.automation_account.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_automation_account_list_deleted_runbooks(self, resource_group): + response = self.client.automation_account.list_deleted_runbooks( + resource_group_name=resource_group.name, + automation_account_name="str", ) 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 f0b11ca91505..bf23be2d1eef 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,12 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_certificate_delete(self, resource_group): - response = self.client.certificate.delete( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +32,15 @@ def test_certificate_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_certificate_get(self, resource_group): - response = self.client.certificate.get( + 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", certificate_name="str", - api_version="2015-10-31", + parameters={ + "name": "str", + "properties": {"base64Value": "str", "description": "str", "isExportable": bool, "thumbprint": "str"}, + }, ) # please add some check logic here by yourself @@ -46,19 +48,12 @@ def test_certificate_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_certificate_create_or_update(self, resource_group): - response = self.client.certificate.create_or_update( + 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={ - "base64Value": "str", - "name": "str", - "description": "str", - "isExportable": bool, - "thumbprint": "str", - }, - api_version="2015-10-31", + parameters={"name": "str", "properties": {"description": "str"}}, ) # please add some check logic here by yourself @@ -66,13 +61,11 @@ def test_certificate_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_certificate_update(self, resource_group): - response = self.client.certificate.update( + 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", - parameters={"description": "str", "name": "str"}, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -84,7 +77,6 @@ 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="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 f11ba5996086..b81ab8477117 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,12 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_certificate_delete(self, resource_group): - response = await self.client.certificate.delete( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +33,15 @@ async def test_certificate_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_certificate_get(self, resource_group): - response = await self.client.certificate.get( + 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", certificate_name="str", - api_version="2015-10-31", + parameters={ + "name": "str", + "properties": {"base64Value": "str", "description": "str", "isExportable": bool, "thumbprint": "str"}, + }, ) # please add some check logic here by yourself @@ -47,19 +49,12 @@ async def test_certificate_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_certificate_create_or_update(self, resource_group): - response = await self.client.certificate.create_or_update( + 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={ - "base64Value": "str", - "name": "str", - "description": "str", - "isExportable": bool, - "thumbprint": "str", - }, - api_version="2015-10-31", + parameters={"name": "str", "properties": {"description": "str"}}, ) # please add some check logic here by yourself @@ -67,13 +62,11 @@ async def test_certificate_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_certificate_update(self, resource_group): - response = await self.client.certificate.update( + 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", - parameters={"description": "str", "name": "str"}, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -85,7 +78,6 @@ 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="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 6a0557b2191d..d8366b4264ae 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,12 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connection_delete(self, resource_group): - response = self.client.connection.delete( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +32,19 @@ def test_connection_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connection_get(self, resource_group): - response = self.client.connection.get( + 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", connection_name="str", - api_version="2015-10-31", + parameters={ + "name": "str", + "properties": { + "connectionType": {"name": "str"}, + "description": "str", + "fieldDefinitionValues": {"str": "str"}, + }, + }, ) # please add some check logic here by yourself @@ -46,18 +52,12 @@ def test_connection_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connection_create_or_update(self, resource_group): - response = self.client.connection.create_or_update( + 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={ - "connectionType": {"name": "str"}, - "name": "str", - "description": "str", - "fieldDefinitionValues": {"str": "str"}, - }, - api_version="2015-10-31", + parameters={"name": "str", "properties": {"description": "str", "fieldDefinitionValues": {"str": "str"}}}, ) # please add some check logic here by yourself @@ -65,13 +65,11 @@ def test_connection_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connection_update(self, resource_group): - response = self.client.connection.update( + 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", - parameters={"description": "str", "fieldDefinitionValues": {"str": "str"}, "name": "str"}, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -83,7 +81,6 @@ 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="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 54e00f7a4b41..2907168cac2f 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,12 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connection_delete(self, resource_group): - response = await self.client.connection.delete( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +33,19 @@ async def test_connection_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connection_get(self, resource_group): - response = await self.client.connection.get( + 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", connection_name="str", - api_version="2015-10-31", + parameters={ + "name": "str", + "properties": { + "connectionType": {"name": "str"}, + "description": "str", + "fieldDefinitionValues": {"str": "str"}, + }, + }, ) # please add some check logic here by yourself @@ -47,18 +53,12 @@ async def test_connection_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connection_create_or_update(self, resource_group): - response = await self.client.connection.create_or_update( + 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={ - "connectionType": {"name": "str"}, - "name": "str", - "description": "str", - "fieldDefinitionValues": {"str": "str"}, - }, - api_version="2015-10-31", + parameters={"name": "str", "properties": {"description": "str", "fieldDefinitionValues": {"str": "str"}}}, ) # please add some check logic here by yourself @@ -66,13 +66,11 @@ async def test_connection_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connection_update(self, resource_group): - response = await self.client.connection.update( + 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", - parameters={"description": "str", "fieldDefinitionValues": {"str": "str"}, "name": "str"}, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -84,7 +82,6 @@ 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="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 b9bebbd8e322..e56cf6c51499 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,12 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connection_type_delete(self, resource_group): - response = self.client.connection_type.delete( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +32,18 @@ def test_connection_type_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connection_type_get(self, resource_group): - response = self.client.connection_type.get( + 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", connection_type_name="str", - api_version="2015-10-31", + parameters={ + "name": "str", + "properties": { + "fieldDefinitions": {"str": {"type": "str", "isEncrypted": bool, "isOptional": bool}}, + "isGlobal": bool, + }, + }, ) # please add some check logic here by yourself @@ -46,17 +51,11 @@ def test_connection_type_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connection_type_create_or_update(self, resource_group): - response = self.client.connection_type.create_or_update( + 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", - parameters={ - "fieldDefinitions": {"str": {"type": "str", "isEncrypted": bool, "isOptional": bool}}, - "name": "str", - "isGlobal": bool, - }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -68,7 +67,6 @@ 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="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 6cb10a005a23..faab87cd17c0 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,12 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connection_type_delete(self, resource_group): - response = await self.client.connection_type.delete( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +33,18 @@ async def test_connection_type_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connection_type_get(self, resource_group): - response = await self.client.connection_type.get( + 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", connection_type_name="str", - api_version="2015-10-31", + parameters={ + "name": "str", + "properties": { + "fieldDefinitions": {"str": {"type": "str", "isEncrypted": bool, "isOptional": bool}}, + "isGlobal": bool, + }, + }, ) # please add some check logic here by yourself @@ -47,17 +52,11 @@ async def test_connection_type_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connection_type_create_or_update(self, resource_group): - response = await self.client.connection_type.create_or_update( + 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", - parameters={ - "fieldDefinitions": {"str": {"type": "str", "isEncrypted": bool, "isOptional": bool}}, - "name": "str", - "isGlobal": bool, - }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -69,7 +68,6 @@ 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="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 939e53e346d1..f7be50639b41 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,12 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_credential_delete(self, resource_group): - response = self.client.credential.delete( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +32,12 @@ def test_credential_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_credential_get(self, resource_group): - response = self.client.credential.get( + 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", - api_version="2015-10-31", + parameters={"name": "str", "properties": {"password": "str", "userName": "str", "description": "str"}}, ) # please add some check logic here by yourself @@ -46,13 +45,12 @@ def test_credential_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_credential_create_or_update(self, resource_group): - response = self.client.credential.create_or_update( + 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={"name": "str", "password": "str", "userName": "str", "description": "str"}, - api_version="2015-10-31", + parameters={"name": "str", "properties": {"description": "str", "password": "str", "userName": "str"}}, ) # please add some check logic here by yourself @@ -60,13 +58,11 @@ def test_credential_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_credential_update(self, resource_group): - response = self.client.credential.update( + 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", - parameters={"description": "str", "name": "str", "password": "str", "userName": "str"}, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -78,7 +74,6 @@ 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="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 96d373713100..33d1c6274972 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,12 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_credential_delete(self, resource_group): - response = await self.client.credential.delete( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +33,12 @@ async def test_credential_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_credential_get(self, resource_group): - response = await self.client.credential.get( + 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", - api_version="2015-10-31", + parameters={"name": "str", "properties": {"password": "str", "userName": "str", "description": "str"}}, ) # please add some check logic here by yourself @@ -47,13 +46,12 @@ async def test_credential_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_credential_create_or_update(self, resource_group): - response = await self.client.credential.create_or_update( + 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={"name": "str", "password": "str", "userName": "str", "description": "str"}, - api_version="2015-10-31", + parameters={"name": "str", "properties": {"description": "str", "password": "str", "userName": "str"}}, ) # please add some check logic here by yourself @@ -61,13 +59,11 @@ async def test_credential_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_credential_update(self, resource_group): - response = await self.client.credential.update( + 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", - parameters={"description": "str", "name": "str", "password": "str", "userName": "str"}, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -79,7 +75,6 @@ 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="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_deleted_automation_accounts_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_deleted_automation_accounts_operations.py index 42183b89a940..a592ce517899 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_deleted_automation_accounts_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_deleted_automation_accounts_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,10 +20,8 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_subscription(self, resource_group): - response = self.client.deleted_automation_accounts.list_by_subscription( - api_version="2022-01-31", - ) + def test_deleted_automation_accounts_list_by_subscription(self, resource_group): + response = self.client.deleted_automation_accounts.list_by_subscription() # please add some check logic here by yourself # ... diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_deleted_automation_accounts_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_deleted_automation_accounts_operations_async.py index 1e4611aaf6f4..af0177c63af8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_deleted_automation_accounts_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_deleted_automation_accounts_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,10 +21,8 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_subscription(self, resource_group): - response = await self.client.deleted_automation_accounts.list_by_subscription( - api_version="2022-01-31", - ) + async def test_deleted_automation_accounts_list_by_subscription(self, resource_group): + response = await self.client.deleted_automation_accounts.list_by_subscription() # 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 deleted file mode 100644 index 547afb5b1a63..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_operations.py +++ /dev/null @@ -1,79 +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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.automation import AutomationClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestAutomationDscCompilationJobOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(AutomationClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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", - compilation_job_name="str", - parameters={ - "configuration": {"name": "str"}, - "incrementNodeConfigurationBuild": bool, - "location": "str", - "name": "str", - "parameters": {"str": "str"}, - "tags": {"str": "str"}, - }, - api_version="2018-01-15", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_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="2018-01-15", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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="2018-01-15", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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="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 deleted file mode 100644 index 74b99e31e657..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_operations_async.py +++ /dev/null @@ -1,82 +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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.automation.aio import AutomationClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestAutomationDscCompilationJobOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(AutomationClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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, - automation_account_name="str", - compilation_job_name="str", - parameters={ - "configuration": {"name": "str"}, - "incrementNodeConfigurationBuild": bool, - "location": "str", - "name": "str", - "parameters": {"str": "str"}, - "tags": {"str": "str"}, - }, - api_version="2018-01-15", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_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="2018-01-15", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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="2018-01-15", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_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="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 deleted file mode 100644 index 72597d3434d1..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_stream_operations.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.automation import AutomationClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestAutomationDscCompilationJobStreamOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(AutomationClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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="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 deleted file mode 100644 index 7c62999df624..000000000000 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_dsc_compilation_job_stream_operations_async.py +++ /dev/null @@ -1,33 +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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.automation.aio import AutomationClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestAutomationDscCompilationJobStreamOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(AutomationClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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="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 4b1f93f3177b..6abd9f48d697 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,19 +18,6 @@ class TestAutomationDscConfigurationOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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="2015-10-31", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_dsc_configuration_get(self, resource_group): @@ -38,7 +25,6 @@ def test_dsc_configuration_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", configuration_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -52,21 +38,22 @@ def test_dsc_configuration_create_or_update(self, resource_group): automation_account_name="str", configuration_name="str", parameters={ - "source": { - "hash": {"algorithm": "str", "value": "str"}, - "type": "str", - "value": "str", - "version": "str", + "properties": { + "source": { + "hash": {"algorithm": "str", "value": "str"}, + "type": "str", + "value": "str", + "version": "str", + }, + "description": "str", + "logProgress": bool, + "logVerbose": bool, + "parameters": {"str": {"defaultValue": "str", "isMandatory": bool, "position": 0, "type": "str"}}, }, - "description": "str", "location": "str", - "logProgress": bool, - "logVerbose": bool, "name": "str", - "parameters": {"str": {"defaultValue": "str", "isMandatory": bool, "position": 0, "type": "str"}}, "tags": {"str": "str"}, }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -79,7 +66,6 @@ def test_dsc_configuration_update(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", configuration_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -87,12 +73,11 @@ def test_dsc_configuration_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_dsc_configuration_get_content(self, resource_group): - response = self.client.dsc_configuration.get_content( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -104,8 +89,19 @@ 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="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + + # 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 4ce7f312e1b4..23333f77aa74 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,19 +19,6 @@ class TestAutomationDscConfigurationOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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="2015-10-31", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_dsc_configuration_get(self, resource_group): @@ -39,7 +26,6 @@ async def test_dsc_configuration_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", configuration_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -53,21 +39,22 @@ async def test_dsc_configuration_create_or_update(self, resource_group): automation_account_name="str", configuration_name="str", parameters={ - "source": { - "hash": {"algorithm": "str", "value": "str"}, - "type": "str", - "value": "str", - "version": "str", + "properties": { + "source": { + "hash": {"algorithm": "str", "value": "str"}, + "type": "str", + "value": "str", + "version": "str", + }, + "description": "str", + "logProgress": bool, + "logVerbose": bool, + "parameters": {"str": {"defaultValue": "str", "isMandatory": bool, "position": 0, "type": "str"}}, }, - "description": "str", "location": "str", - "logProgress": bool, - "logVerbose": bool, "name": "str", - "parameters": {"str": {"defaultValue": "str", "isMandatory": bool, "position": 0, "type": "str"}}, "tags": {"str": "str"}, }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -80,7 +67,6 @@ async def test_dsc_configuration_update(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", configuration_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -88,12 +74,11 @@ async def test_dsc_configuration_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_dsc_configuration_get_content(self, resource_group): - response = await self.client.dsc_configuration.get_content( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -105,8 +90,19 @@ 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="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_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", + ) + + # 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 f935baea4eca..940b44a2d72c 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,19 +18,6 @@ class TestAutomationDscNodeConfigurationOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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="2018-01-15", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_dsc_node_configuration_get(self, resource_group): @@ -38,7 +25,6 @@ def test_dsc_node_configuration_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", node_configuration_name="str", - api_version="2018-01-15", ) # please add some check logic here by yourself @@ -52,30 +38,42 @@ def test_dsc_node_configuration_begin_create_or_update(self, resource_group): automation_account_name="str", node_configuration_name="str", parameters={ - "configuration": {"name": "str"}, - "incrementNodeConfigurationBuild": bool, "name": "str", - "source": { - "hash": {"algorithm": "str", "value": "str"}, - "type": "str", - "value": "str", - "version": "str", + "properties": { + "configuration": {"name": "str"}, + "source": { + "hash": {"algorithm": "str", "value": "str"}, + "type": "str", + "value": "str", + "version": "str", + }, + "incrementNodeConfigurationBuild": bool, }, "tags": {"str": "str"}, }, - api_version="2018-01-15", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_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", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy 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="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 fff5e931b76f..084f71ec6108 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,19 +19,6 @@ class TestAutomationDscNodeConfigurationOperationsAsync(AzureMgmtRecordedTestCas def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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="2018-01-15", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_dsc_node_configuration_get(self, resource_group): @@ -39,7 +26,6 @@ async def test_dsc_node_configuration_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", node_configuration_name="str", - api_version="2018-01-15", ) # please add some check logic here by yourself @@ -54,31 +40,43 @@ async def test_dsc_node_configuration_begin_create_or_update(self, resource_grou automation_account_name="str", node_configuration_name="str", parameters={ - "configuration": {"name": "str"}, - "incrementNodeConfigurationBuild": bool, "name": "str", - "source": { - "hash": {"algorithm": "str", "value": "str"}, - "type": "str", - "value": "str", - "version": "str", + "properties": { + "configuration": {"name": "str"}, + "source": { + "hash": {"algorithm": "str", "value": "str"}, + "type": "str", + "value": "str", + "version": "str", + }, + "incrementNodeConfigurationBuild": bool, }, "tags": {"str": "str"}, }, - api_version="2018-01-15", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_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", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async 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="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 730d120f6f53..372b7c7c923c 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,12 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_dsc_node_delete(self, resource_group): - response = self.client.dsc_node.delete( + 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="2018-01-15", ) # please add some check logic here by yourself @@ -33,12 +32,12 @@ def test_dsc_node_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_dsc_node_get(self, resource_group): - response = self.client.dsc_node.get( + 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", - api_version="2018-01-15", + dsc_node_update_parameters={"nodeId": "str", "properties": {"nodeConfiguration": {"name": "str"}}}, ) # please add some check logic here by yourself @@ -46,13 +45,11 @@ def test_dsc_node_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_dsc_node_update(self, resource_group): - response = self.client.dsc_node.update( + 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", - dsc_node_update_parameters={"nodeId": "str", "properties": {"name": "str"}}, - api_version="2018-01-15", ) # please add some check logic here by yourself @@ -64,7 +61,6 @@ 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="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 0eb3ee0dfc0d..6c9fa7936c77 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,12 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_dsc_node_delete(self, resource_group): - response = await self.client.dsc_node.delete( + 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="2018-01-15", ) # please add some check logic here by yourself @@ -34,12 +33,12 @@ async def test_dsc_node_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_dsc_node_get(self, resource_group): - response = await self.client.dsc_node.get( + 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", - api_version="2018-01-15", + dsc_node_update_parameters={"nodeId": "str", "properties": {"nodeConfiguration": {"name": "str"}}}, ) # please add some check logic here by yourself @@ -47,13 +46,11 @@ async def test_dsc_node_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_dsc_node_update(self, resource_group): - response = await self.client.dsc_node.update( + 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", - dsc_node_update_parameters={"nodeId": "str", "properties": {"name": "str"}}, - api_version="2018-01-15", ) # please add some check logic here by yourself @@ -65,7 +62,6 @@ 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="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 1e547c8fcd4e..fac0ad338264 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ def test_fields_list_by_type(self, resource_group): automation_account_name="str", module_name="str", type_name="str", - 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 4e2a021b494c..134613f5e318 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -27,7 +27,6 @@ async def test_fields_list_by_type(self, resource_group): automation_account_name="str", module_name="str", type_name="str", - 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 c4552028644f..bd297a001d9a 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,12 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_hybrid_runbook_worker_group_delete(self, resource_group): - response = self.client.hybrid_runbook_worker_group.delete( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +32,15 @@ def test_hybrid_runbook_worker_group_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_hybrid_runbook_worker_group_get(self, resource_group): - response = self.client.hybrid_runbook_worker_group.get( + def test_hybrid_runbook_worker_group_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", - api_version="2015-10-31", + hybrid_runbook_worker_group_creation_parameters={ + "name": "str", + "properties": {"credential": {"name": "str"}}, + }, ) # please add some check logic here by yourself @@ -51,8 +53,22 @@ def test_hybrid_runbook_worker_group_update(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", - parameters={"credential": {"name": "str"}}, - api_version="2015-10-31", + hybrid_runbook_worker_group_updation_parameters={ + "name": "str", + "properties": {"credential": {"name": "str"}}, + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", ) # please add some check logic here by yourself @@ -64,7 +80,6 @@ def test_hybrid_runbook_worker_group_list_by_automation_account(self, resource_g response = self.client.hybrid_runbook_worker_group.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - 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 6ccfb71b8eb2..23f500060f25 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,12 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_hybrid_runbook_worker_group_delete(self, resource_group): - response = await self.client.hybrid_runbook_worker_group.delete( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +33,15 @@ async def test_hybrid_runbook_worker_group_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_hybrid_runbook_worker_group_get(self, resource_group): - response = await self.client.hybrid_runbook_worker_group.get( + async def test_hybrid_runbook_worker_group_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", - api_version="2015-10-31", + hybrid_runbook_worker_group_creation_parameters={ + "name": "str", + "properties": {"credential": {"name": "str"}}, + }, ) # please add some check logic here by yourself @@ -52,8 +54,22 @@ async def test_hybrid_runbook_worker_group_update(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", - parameters={"credential": {"name": "str"}}, - api_version="2015-10-31", + hybrid_runbook_worker_group_updation_parameters={ + "name": "str", + "properties": {"credential": {"name": "str"}}, + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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", ) # please add some check logic here by yourself @@ -65,7 +81,6 @@ async def test_hybrid_runbook_worker_group_list_by_automation_account(self, reso response = self.client.hybrid_runbook_worker_group.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - 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_workers_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_workers_operations.py index ace4f4aa429b..d0abaa48f441 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_workers_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_workers_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,13 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): - response = self.client.hybrid_runbook_workers.delete( + def test_hybrid_runbook_workers_get(self, resource_group): + response = self.client.hybrid_runbook_workers.get( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", hybrid_runbook_worker_id="str", - api_version="2022-08-08", ) # please add some check logic here by yourself @@ -34,13 +33,13 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): - response = self.client.hybrid_runbook_workers.get( + def test_hybrid_runbook_workers_create(self, resource_group): + response = self.client.hybrid_runbook_workers.create( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", hybrid_runbook_worker_id="str", - api_version="2022-08-08", + hybrid_runbook_worker_creation_parameters={"name": "str", "properties": {"vmResourceId": "str"}}, ) # please add some check logic here by yourself @@ -48,14 +47,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create(self, resource_group): - response = self.client.hybrid_runbook_workers.create( + def test_hybrid_runbook_workers_patch(self, resource_group): + response = self.client.hybrid_runbook_workers.patch( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", hybrid_runbook_worker_id="str", - hybrid_runbook_worker_creation_parameters={"name": "str", "vmResourceId": "str"}, - api_version="2022-08-08", ) # please add some check logic here by yourself @@ -63,14 +60,12 @@ def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_move(self, resource_group): - response = self.client.hybrid_runbook_workers.move( + def test_hybrid_runbook_workers_delete(self, resource_group): + response = self.client.hybrid_runbook_workers.delete( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", hybrid_runbook_worker_id="str", - hybrid_runbook_worker_move_parameters={"hybridRunbookWorkerGroupName": "str"}, - api_version="2022-08-08", ) # please add some check logic here by yourself @@ -78,13 +73,26 @@ def test_move(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_hybrid_runbook_worker_group(self, resource_group): + def test_hybrid_runbook_workers_list_by_hybrid_runbook_worker_group(self, resource_group): response = self.client.hybrid_runbook_workers.list_by_hybrid_runbook_worker_group( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", - api_version="2022-08-08", ) result = [r for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_hybrid_runbook_workers_move(self, resource_group): + response = self.client.hybrid_runbook_workers.move( + resource_group_name=resource_group.name, + automation_account_name="str", + hybrid_runbook_worker_group_name="str", + hybrid_runbook_worker_id="str", + hybrid_runbook_worker_move_parameters={"hybridRunbookWorkerGroupName": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_workers_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_workers_operations_async.py index 850aad3f89be..b9f24e2ab92d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_workers_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_hybrid_runbook_workers_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,13 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): - response = await self.client.hybrid_runbook_workers.delete( + async def test_hybrid_runbook_workers_get(self, resource_group): + response = await self.client.hybrid_runbook_workers.get( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", hybrid_runbook_worker_id="str", - api_version="2022-08-08", ) # please add some check logic here by yourself @@ -35,13 +34,13 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): - response = await self.client.hybrid_runbook_workers.get( + async def test_hybrid_runbook_workers_create(self, resource_group): + response = await self.client.hybrid_runbook_workers.create( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", hybrid_runbook_worker_id="str", - api_version="2022-08-08", + hybrid_runbook_worker_creation_parameters={"name": "str", "properties": {"vmResourceId": "str"}}, ) # please add some check logic here by yourself @@ -49,14 +48,12 @@ 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_workers.create( + async def test_hybrid_runbook_workers_patch(self, resource_group): + response = await self.client.hybrid_runbook_workers.patch( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", hybrid_runbook_worker_id="str", - hybrid_runbook_worker_creation_parameters={"name": "str", "vmResourceId": "str"}, - api_version="2022-08-08", ) # please add some check logic here by yourself @@ -64,14 +61,12 @@ async def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_move(self, resource_group): - response = await self.client.hybrid_runbook_workers.move( + async def test_hybrid_runbook_workers_delete(self, resource_group): + response = await self.client.hybrid_runbook_workers.delete( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", hybrid_runbook_worker_id="str", - hybrid_runbook_worker_move_parameters={"hybridRunbookWorkerGroupName": "str"}, - api_version="2022-08-08", ) # please add some check logic here by yourself @@ -79,13 +74,26 @@ async def test_move(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_hybrid_runbook_worker_group(self, resource_group): + async def test_hybrid_runbook_workers_list_by_hybrid_runbook_worker_group(self, resource_group): response = self.client.hybrid_runbook_workers.list_by_hybrid_runbook_worker_group( resource_group_name=resource_group.name, automation_account_name="str", hybrid_runbook_worker_group_name="str", - api_version="2022-08-08", ) result = [r async for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_hybrid_runbook_workers_move(self, resource_group): + response = await self.client.hybrid_runbook_workers.move( + resource_group_name=resource_group.name, + automation_account_name="str", + hybrid_runbook_worker_group_name="str", + hybrid_runbook_worker_id="str", + hybrid_runbook_worker_move_parameters={"hybridRunbookWorkerGroupName": "str"}, + ) + + # 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 d6f152acd57e..d83076668181 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,25 +20,22 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_job_get_output(self, resource_group): - response = self.client.job.get_output( + 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", - job_name="str", - api_version="2017-05-15-preview", ) - + result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_job_get_runbook_content(self, resource_group): - response = self.client.job.get_runbook_content( + 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="2017-05-15-preview", ) # please add some check logic here by yourself @@ -46,12 +43,12 @@ def test_job_get_runbook_content(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_job_suspend(self, resource_group): - response = self.client.job.suspend( + 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", - api_version="2017-05-15-preview", + parameters={"properties": {"parameters": {"str": "str"}, "runOn": "str", "runbook": {"name": "str"}}}, ) # please add some check logic here by yourself @@ -59,12 +56,11 @@ def test_job_suspend(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_job_stop(self, resource_group): - response = self.client.job.stop( + 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="2017-05-15-preview", ) # please add some check logic here by yourself @@ -72,12 +68,11 @@ def test_job_stop(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_job_get(self, resource_group): - response = self.client.job.get( + 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="2017-05-15-preview", ) # please add some check logic here by yourself @@ -85,13 +80,11 @@ def test_job_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_job_create(self, resource_group): - response = self.client.job.create( + 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", - parameters={"parameters": {"str": "str"}, "runOn": "str", "runbook": {"name": "str"}}, - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -99,13 +92,13 @@ def test_job_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_job_list_by_automation_account(self, resource_group): - response = self.client.job.list_by_automation_account( + def test_job_stop(self, resource_group): + response = self.client.job.stop( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2017-05-15-preview", + job_name="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @@ -116,7 +109,6 @@ def test_job_resume(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - 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 302f7c39ce3c..d38c984b9e6d 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,25 +21,22 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_job_get_output(self, resource_group): - response = await self.client.job.get_output( + 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", - job_name="str", - api_version="2017-05-15-preview", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_job_get_runbook_content(self, resource_group): - response = await self.client.job.get_runbook_content( + 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="2017-05-15-preview", ) # please add some check logic here by yourself @@ -47,12 +44,12 @@ async def test_job_get_runbook_content(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_job_suspend(self, resource_group): - response = await self.client.job.suspend( + 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", - api_version="2017-05-15-preview", + parameters={"properties": {"parameters": {"str": "str"}, "runOn": "str", "runbook": {"name": "str"}}}, ) # please add some check logic here by yourself @@ -60,12 +57,11 @@ async def test_job_suspend(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_job_stop(self, resource_group): - response = await self.client.job.stop( + 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="2017-05-15-preview", ) # please add some check logic here by yourself @@ -73,12 +69,11 @@ async def test_job_stop(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_job_get(self, resource_group): - response = await self.client.job.get( + 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="2017-05-15-preview", ) # please add some check logic here by yourself @@ -86,13 +81,11 @@ async def test_job_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_job_create(self, resource_group): - response = await self.client.job.create( + 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", - parameters={"parameters": {"str": "str"}, "runOn": "str", "runbook": {"name": "str"}}, - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -100,13 +93,13 @@ async def test_job_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_job_list_by_automation_account(self, resource_group): - response = self.client.job.list_by_automation_account( + async def test_job_stop(self, resource_group): + response = await self.client.job.stop( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2017-05-15-preview", + job_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @@ -117,7 +110,6 @@ async def test_job_resume(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - 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 b0c34e38f0cf..5e7e881dfe9d 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,12 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_job_schedule_delete(self, resource_group): - response = self.client.job_schedule.delete( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +32,19 @@ def test_job_schedule_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_job_schedule_get(self, resource_group): - response = self.client.job_schedule.get( + def test_job_schedule_create(self, resource_group): + response = self.client.job_schedule.create( resource_group_name=resource_group.name, automation_account_name="str", job_schedule_id="str", - api_version="2015-10-31", + parameters={ + "properties": { + "runbook": {"name": "str"}, + "schedule": {"name": "str"}, + "parameters": {"str": "str"}, + "runOn": "str", + } + }, ) # please add some check logic here by yourself @@ -46,18 +52,11 @@ def test_job_schedule_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_job_schedule_create(self, resource_group): - response = self.client.job_schedule.create( + 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", - parameters={ - "runbook": {"name": "str"}, - "schedule": {"name": "str"}, - "parameters": {"str": "str"}, - "runOn": "str", - }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -69,7 +68,6 @@ 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="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 c7136de4608f..d12dbf8da877 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,12 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_job_schedule_delete(self, resource_group): - response = await self.client.job_schedule.delete( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -34,12 +33,19 @@ async def test_job_schedule_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_job_schedule_get(self, resource_group): - response = await self.client.job_schedule.get( + 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", job_schedule_id="str", - api_version="2015-10-31", + parameters={ + "properties": { + "runbook": {"name": "str"}, + "schedule": {"name": "str"}, + "parameters": {"str": "str"}, + "runOn": "str", + } + }, ) # please add some check logic here by yourself @@ -47,18 +53,11 @@ async def test_job_schedule_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_job_schedule_create(self, resource_group): - response = await self.client.job_schedule.create( + 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", - parameters={ - "runbook": {"name": "str"}, - "schedule": {"name": "str"}, - "parameters": {"str": "str"}, - "runOn": "str", - }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -70,7 +69,6 @@ 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="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 8d34dbebfb3d..e80ea7201a06 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ def test_job_stream_get(self, resource_group): automation_account_name="str", job_name="str", job_stream_id="str", - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -39,7 +38,6 @@ def test_job_stream_list_by_job(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - 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 c6d0d65882ad..fa81037f8fa7 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -27,7 +27,6 @@ async def test_job_stream_get(self, resource_group): automation_account_name="str", job_name="str", job_stream_id="str", - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -40,7 +39,6 @@ async def test_job_stream_list_by_job(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", job_name="str", - 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 cba2f6e81d0e..687a77573bbb 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ 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="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 6ff3c770fa03..59b39a3bc269 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ 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="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 b09e9ce8b374..b1c5e611b562 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ 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="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 c55e4b97c529..2b8a1b481a65 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ 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="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 67fffb53ca38..cd524a5c10b5 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,19 +18,6 @@ class TestAutomationModuleOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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="2015-10-31", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_module_get(self, resource_group): @@ -38,7 +25,6 @@ def test_module_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", module_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -52,12 +38,13 @@ def test_module_create_or_update(self, resource_group): automation_account_name="str", module_name="str", parameters={ - "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"}, + "properties": { + "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"} + }, "location": "str", "name": "str", "tags": {"str": "str"}, }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -71,12 +58,25 @@ def test_module_update(self, resource_group): automation_account_name="str", module_name="str", parameters={ - "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"}, "location": "str", "name": "str", + "properties": { + "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"} + }, "tags": {"str": "str"}, }, - api_version="2015-10-31", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", ) # please add some check logic here by yourself @@ -88,7 +88,6 @@ 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="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 46394f942b47..0b655a6d04a6 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,19 +19,6 @@ class TestAutomationModuleOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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="2015-10-31", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_module_get(self, resource_group): @@ -39,7 +26,6 @@ async def test_module_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", module_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -53,12 +39,13 @@ async def test_module_create_or_update(self, resource_group): automation_account_name="str", module_name="str", parameters={ - "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"}, + "properties": { + "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"} + }, "location": "str", "name": "str", "tags": {"str": "str"}, }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -72,12 +59,25 @@ async def test_module_update(self, resource_group): automation_account_name="str", module_name="str", parameters={ - "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"}, "location": "str", "name": "str", + "properties": { + "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"} + }, "tags": {"str": "str"}, }, - api_version="2015-10-31", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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", ) # please add some check logic here by yourself @@ -89,7 +89,6 @@ 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="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 97a5b5c8b104..a5c7000db6e9 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ def test_node_count_information_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", count_type="str", - 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 1bf946fcae1f..d1af65a9ef69 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ async def test_node_count_information_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", count_type="str", - 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 74cb2be03335..a46102bd3129 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ def test_node_reports_list_by_node(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", node_id="str", - api_version="2018-01-15", ) result = [r for r in response] # please add some check logic here by yourself @@ -39,7 +38,6 @@ def test_node_reports_get(self, resource_group): automation_account_name="str", node_id="str", report_id="str", - api_version="2018-01-15", ) # please add some check logic here by yourself @@ -53,7 +51,6 @@ def test_node_reports_get_content(self, resource_group): automation_account_name="str", node_id="str", report_id="str", - 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 1023335550b6..b37aa267629d 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ async def test_node_reports_list_by_node(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", node_id="str", - api_version="2018-01-15", ) result = [r async for r in response] # please add some check logic here by yourself @@ -40,7 +39,6 @@ async def test_node_reports_get(self, resource_group): automation_account_name="str", node_id="str", report_id="str", - api_version="2018-01-15", ) # please add some check logic here by yourself @@ -54,7 +52,6 @@ async def test_node_reports_get_content(self, resource_group): automation_account_name="str", node_id="str", report_id="str", - 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 e12c783fb1cb..681ab2d062e7 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,13 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - 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( + 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", - module_name="str", type_name="str", - api_version="2015-10-31", ) result = [r for r in response] # please add some check logic here by yourself @@ -34,12 +32,12 @@ def test_object_data_types_list_fields_by_module_and_type(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_object_data_types_list_fields_by_type(self, resource_group): - response = self.client.object_data_types.list_fields_by_type( + 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="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 65d25790aaf7..b1f7b687235a 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,13 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - 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( + 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", - module_name="str", type_name="str", - api_version="2015-10-31", ) result = [r async for r in response] # please add some check logic here by yourself @@ -35,12 +33,12 @@ async def test_object_data_types_list_fields_by_module_and_type(self, resource_g @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_object_data_types_list_fields_by_type(self, resource_group): - response = self.client.object_data_types.list_fields_by_type( + 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="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 54bace263cdc..c9ea5bbbeec8 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,9 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2015-10-31", - ) + response = self.client.operations.list() 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 405245218ab2..e470e790b49b 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -22,9 +22,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2015-10-31", - ) + response = self.client.operations.list() 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_package_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_package_operations.py new file mode 100644 index 000000000000..25c1347d5248 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_package_operations.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.automation import AutomationClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAutomationPackageOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AutomationClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_package_get(self, resource_group): + response = self.client.package.get( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + package_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_package_create_or_update(self, resource_group): + response = self.client.package.create_or_update( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + package_name="str", + parameters={ + "properties": { + "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"} + }, + "allOf": { + "location": "str", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_package_update(self, resource_group): + response = self.client.package.update( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + package_name="str", + parameters={ + "allOf": { + "location": "str", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + "properties": { + "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"} + }, + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_package_delete(self, resource_group): + response = self.client.package.delete( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + package_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_package_list_by_runtime_environment(self, resource_group): + response = self.client.package.list_by_runtime_environment( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + ) + 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_package_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_package_operations_async.py new file mode 100644 index 000000000000..7a9dac15e106 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_package_operations_async.py @@ -0,0 +1,124 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.automation.aio import AutomationClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAutomationPackageOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AutomationClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_package_get(self, resource_group): + response = await self.client.package.get( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + package_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_package_create_or_update(self, resource_group): + response = await self.client.package.create_or_update( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + package_name="str", + parameters={ + "properties": { + "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"} + }, + "allOf": { + "location": "str", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_package_update(self, resource_group): + response = await self.client.package.update( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + package_name="str", + parameters={ + "allOf": { + "location": "str", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + "properties": { + "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"} + }, + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_package_delete(self, resource_group): + response = await self.client.package.delete( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + package_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_package_list_by_runtime_environment(self, resource_group): + response = self.client.package.list_by_runtime_environment( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + ) + 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_private_endpoint_connections_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_private_endpoint_connections_operations.py index 644454f2f37b..153d39faedf0 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_private_endpoint_connections_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_private_endpoint_connections_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,24 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): - response = self.client.private_endpoint_connections.list_by_automation_account( - resource_group_name=resource_group.name, - automation_account_name="str", - api_version="2020-01-13-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_get(self, resource_group): + def test_private_endpoint_connections_get(self, resource_group): response = self.client.private_endpoint_connections.get( resource_group_name=resource_group.name, automation_account_name="str", private_endpoint_connection_name="str", - api_version="2020-01-13-preview", ) # please add some check logic here by yourself @@ -45,20 +32,33 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_private_endpoint_connections_begin_create_or_update(self, resource_group): response = self.client.private_endpoint_connections.begin_create_or_update( resource_group_name=resource_group.name, automation_account_name="str", private_endpoint_connection_name="str", parameters={ - "groupIds": ["str"], "id": "str", "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "properties": { + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "type": "str", }, - api_version="2020-01-13-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -66,13 +66,23 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_private_endpoint_connections_begin_delete(self, resource_group): response = self.client.private_endpoint_connections.begin_delete( resource_group_name=resource_group.name, automation_account_name="str", private_endpoint_connection_name="str", - api_version="2020-01-13-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_list_by_automation_account(self, resource_group): + response = self.client.private_endpoint_connections.list_by_automation_account( + resource_group_name=resource_group.name, + automation_account_name="str", + ) + 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_private_endpoint_connections_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_private_endpoint_connections_operations_async.py index 7204890b0c33..226614e95589 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_private_endpoint_connections_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_private_endpoint_connections_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,24 +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): - response = self.client.private_endpoint_connections.list_by_automation_account( - resource_group_name=resource_group.name, - automation_account_name="str", - api_version="2020-01-13-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_private_endpoint_connections_get(self, resource_group): response = await self.client.private_endpoint_connections.get( resource_group_name=resource_group.name, automation_account_name="str", private_endpoint_connection_name="str", - api_version="2020-01-13-preview", ) # please add some check logic here by yourself @@ -46,25 +33,34 @@ 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_private_endpoint_connections_begin_create_or_update(self, resource_group): response = await ( await self.client.private_endpoint_connections.begin_create_or_update( resource_group_name=resource_group.name, automation_account_name="str", private_endpoint_connection_name="str", parameters={ - "groupIds": ["str"], "id": "str", "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", + "properties": { + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", }, "type": "str", }, - api_version="2020-01-13-preview", ) ).result() # call '.result()' to poll until service return final result @@ -73,15 +69,25 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_private_endpoint_connections_begin_delete(self, resource_group): response = await ( await self.client.private_endpoint_connections.begin_delete( resource_group_name=resource_group.name, automation_account_name="str", private_endpoint_connection_name="str", - api_version="2020-01-13-preview", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_list_by_automation_account(self, resource_group): + response = self.client.private_endpoint_connections.list_by_automation_account( + resource_group_name=resource_group.name, + automation_account_name="str", + ) + 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_private_link_resources_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_private_link_resources_operations.py index dd9c6f4da5e8..46da8e54c4aa 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_private_link_resources_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_private_link_resources_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,11 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_automation(self, resource_group): + def test_private_link_resources_automation(self, resource_group): response = self.client.private_link_resources.automation( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2020-01-13-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_private_link_resources_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_private_link_resources_operations_async.py index f07a4e78b988..f1b8bebf4c8f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_private_link_resources_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_private_link_resources_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,11 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_automation(self, resource_group): + async def test_private_link_resources_automation(self, resource_group): response = self.client.private_link_resources.automation( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2020-01-13-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_python2_package_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python2_package_operations.py index 36ffc857f8eb..23ee419b69e2 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,19 +18,6 @@ class TestAutomationPython2PackageOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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="2018-06-30", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_python2_package_get(self, resource_group): @@ -38,7 +25,6 @@ def test_python2_package_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -52,10 +38,11 @@ def test_python2_package_create_or_update(self, resource_group): automation_account_name="str", package_name="str", parameters={ - "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"}, + "properties": { + "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"} + }, "tags": {"str": "str"}, }, - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -69,7 +56,18 @@ def test_python2_package_update(self, resource_group): automation_account_name="str", package_name="str", parameters={"tags": {"str": "str"}}, - api_version="2018-06-30", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", ) # please add some check logic here by yourself @@ -81,7 +79,6 @@ 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="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 83dcb2a54305..5b71a882092e 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,19 +19,6 @@ class TestAutomationPython2PackageOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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="2018-06-30", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_python2_package_get(self, resource_group): @@ -39,7 +26,6 @@ async def test_python2_package_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -53,10 +39,11 @@ async def test_python2_package_create_or_update(self, resource_group): automation_account_name="str", package_name="str", parameters={ - "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"}, + "properties": { + "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"} + }, "tags": {"str": "str"}, }, - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -70,7 +57,18 @@ async def test_python2_package_update(self, resource_group): automation_account_name="str", package_name="str", parameters={"tags": {"str": "str"}}, - api_version="2018-06-30", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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", ) # please add some check logic here by yourself @@ -82,7 +80,6 @@ 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="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_python3_package_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python3_package_operations.py index 5118fe4e6af1..4f0eb5ef30bd 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python3_package_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python3_package_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,12 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): - response = self.client.python3_package.delete( + def test_python3_package_get(self, resource_group): + response = self.client.python3_package.get( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - api_version="2022-08-08", ) # please add some check logic here by yourself @@ -33,12 +32,17 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): - response = self.client.python3_package.get( + def test_python3_package_create_or_update(self, resource_group): + response = self.client.python3_package.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - api_version="2022-08-08", + parameters={ + "properties": { + "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"} + }, + "tags": {"str": "str"}, + }, ) # please add some check logic here by yourself @@ -46,16 +50,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): - response = self.client.python3_package.create_or_update( + def test_python3_package_update(self, resource_group): + response = self.client.python3_package.update( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - parameters={ - "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"}, - "tags": {"str": "str"}, - }, - api_version="2022-08-08", + parameters={"tags": {"str": "str"}}, ) # please add some check logic here by yourself @@ -63,13 +63,11 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): - response = self.client.python3_package.update( + def test_python3_package_delete(self, resource_group): + response = self.client.python3_package.delete( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - parameters={"tags": {"str": "str"}}, - api_version="2022-08-08", ) # please add some check logic here by yourself @@ -77,11 +75,10 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_automation_account(self, resource_group): + def test_python3_package_list_by_automation_account(self, resource_group): response = self.client.python3_package.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", ) 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_python3_package_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python3_package_operations_async.py index 6c0a432c5512..0fe644327a00 100644 --- a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python3_package_operations_async.py +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_python3_package_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,12 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): - response = await self.client.python3_package.delete( + async def test_python3_package_get(self, resource_group): + response = await self.client.python3_package.get( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - api_version="2022-08-08", ) # please add some check logic here by yourself @@ -34,12 +33,17 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): - response = await self.client.python3_package.get( + async def test_python3_package_create_or_update(self, resource_group): + response = await self.client.python3_package.create_or_update( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - api_version="2022-08-08", + parameters={ + "properties": { + "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"} + }, + "tags": {"str": "str"}, + }, ) # please add some check logic here by yourself @@ -47,16 +51,12 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): - response = await self.client.python3_package.create_or_update( + async def test_python3_package_update(self, resource_group): + response = await self.client.python3_package.update( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - parameters={ - "contentLink": {"contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str"}, - "tags": {"str": "str"}, - }, - api_version="2022-08-08", + parameters={"tags": {"str": "str"}}, ) # please add some check logic here by yourself @@ -64,13 +64,11 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): - response = await self.client.python3_package.update( + async def test_python3_package_delete(self, resource_group): + response = await self.client.python3_package.delete( resource_group_name=resource_group.name, automation_account_name="str", package_name="str", - parameters={"tags": {"str": "str"}}, - api_version="2022-08-08", ) # please add some check logic here by yourself @@ -78,11 +76,10 @@ 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_python3_package_list_by_automation_account(self, resource_group): response = self.client.python3_package.list_by_automation_account( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2022-08-08", ) 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 4f74c7a38139..211f7f041a3a 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ def test_runbook_draft_get_content(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -38,8 +37,8 @@ def test_runbook_draft_begin_replace_content(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - runbook_content=b"bytes", - api_version="2018-06-30", + runbook_content="str", + content_type="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -52,7 +51,6 @@ def test_runbook_draft_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -65,7 +63,6 @@ def test_runbook_draft_undo_edit(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - 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 538989c934cb..e5bdbd6127eb 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ async def test_runbook_draft_get_content(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -40,8 +39,8 @@ async def test_runbook_draft_begin_replace_content(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - runbook_content=b"bytes", - api_version="2018-06-30", + runbook_content="str", + content_type="str", ) ).result() # call '.result()' to poll until service return final result @@ -55,7 +54,6 @@ async def test_runbook_draft_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -68,7 +66,6 @@ async def test_runbook_draft_undo_edit(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - 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 ffcd7ccd02dc..4ecc17541eb7 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,32 +18,6 @@ class TestAutomationRunbookOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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="2018-06-30", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_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="2018-06-30", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_runbook_get(self, resource_group): @@ -51,7 +25,6 @@ def test_runbook_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -65,33 +38,37 @@ def test_runbook_create_or_update(self, resource_group): automation_account_name="str", runbook_name="str", parameters={ - "runbookType": "str", - "description": "str", - "draft": { - "creationTime": "2020-02-20 00:00:00", - "draftContentLink": { + "properties": { + "runbookType": "str", + "description": "str", + "draft": { + "creationTime": "2020-02-20 00:00:00", + "draftContentLink": { + "contentHash": {"algorithm": "str", "value": "str"}, + "uri": "str", + "version": "str", + }, + "inEdit": bool, + "lastModifiedTime": "2020-02-20 00:00:00", + "outputTypes": ["str"], + "parameters": { + "str": {"defaultValue": "str", "isMandatory": bool, "position": 0, "type": "str"} + }, + }, + "logActivityTrace": 0, + "logProgress": bool, + "logVerbose": bool, + "publishContentLink": { "contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str", }, - "inEdit": bool, - "lastModifiedTime": "2020-02-20 00:00:00", - "outputTypes": ["str"], - "parameters": {"str": {"defaultValue": "str", "isMandatory": bool, "position": 0, "type": "str"}}, + "runtimeEnvironment": "str", }, "location": "str", - "logActivityTrace": 0, - "logProgress": bool, - "logVerbose": bool, "name": "str", - "publishContentLink": { - "contentHash": {"algorithm": "str", "value": "str"}, - "uri": "str", - "version": "str", - }, "tags": {"str": "str"}, }, - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -105,15 +82,11 @@ def test_runbook_update(self, resource_group): automation_account_name="str", runbook_name="str", parameters={ - "description": "str", "location": "str", - "logActivityTrace": 0, - "logProgress": bool, - "logVerbose": bool, "name": "str", + "properties": {"description": "str", "logActivityTrace": 0, "logProgress": bool, "logVerbose": bool}, "tags": {"str": "str"}, }, - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -126,7 +99,6 @@ def test_runbook_delete(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -138,8 +110,31 @@ 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="2018-06-30", ) result = [r for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_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", + ) + + # 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 842dabcbd5a9..8e55ed98567b 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,34 +19,6 @@ class TestAutomationRunbookOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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="2018-06-30", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_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="2018-06-30", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_runbook_get(self, resource_group): @@ -54,7 +26,6 @@ async def test_runbook_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -68,33 +39,37 @@ async def test_runbook_create_or_update(self, resource_group): automation_account_name="str", runbook_name="str", parameters={ - "runbookType": "str", - "description": "str", - "draft": { - "creationTime": "2020-02-20 00:00:00", - "draftContentLink": { + "properties": { + "runbookType": "str", + "description": "str", + "draft": { + "creationTime": "2020-02-20 00:00:00", + "draftContentLink": { + "contentHash": {"algorithm": "str", "value": "str"}, + "uri": "str", + "version": "str", + }, + "inEdit": bool, + "lastModifiedTime": "2020-02-20 00:00:00", + "outputTypes": ["str"], + "parameters": { + "str": {"defaultValue": "str", "isMandatory": bool, "position": 0, "type": "str"} + }, + }, + "logActivityTrace": 0, + "logProgress": bool, + "logVerbose": bool, + "publishContentLink": { "contentHash": {"algorithm": "str", "value": "str"}, "uri": "str", "version": "str", }, - "inEdit": bool, - "lastModifiedTime": "2020-02-20 00:00:00", - "outputTypes": ["str"], - "parameters": {"str": {"defaultValue": "str", "isMandatory": bool, "position": 0, "type": "str"}}, + "runtimeEnvironment": "str", }, "location": "str", - "logActivityTrace": 0, - "logProgress": bool, - "logVerbose": bool, "name": "str", - "publishContentLink": { - "contentHash": {"algorithm": "str", "value": "str"}, - "uri": "str", - "version": "str", - }, "tags": {"str": "str"}, }, - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -108,15 +83,11 @@ async def test_runbook_update(self, resource_group): automation_account_name="str", runbook_name="str", parameters={ - "description": "str", "location": "str", - "logActivityTrace": 0, - "logProgress": bool, - "logVerbose": bool, "name": "str", + "properties": {"description": "str", "logActivityTrace": 0, "logProgress": bool, "logVerbose": bool}, "tags": {"str": "str"}, }, - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -129,7 +100,6 @@ async def test_runbook_delete(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -141,8 +111,33 @@ 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="2018-06-30", ) result = [r async for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_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", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_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", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runtime_environments_operations.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runtime_environments_operations.py new file mode 100644 index 000000000000..19a8821c5180 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runtime_environments_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.automation import AutomationClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAutomationRuntimeEnvironmentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AutomationClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_runtime_environments_get(self, resource_group): + response = self.client.runtime_environments.get( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_runtime_environments_create(self, resource_group): + response = self.client.runtime_environments.create( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + parameters={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "defaultPackages": {"str": "str"}, + "description": "str", + "runtime": {"language": "str", "version": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_runtime_environments_update(self, resource_group): + response = self.client.runtime_environments.update( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + parameters={ + "properties": {"defaultPackages": {"str": "str"}}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_runtime_environments_delete(self, resource_group): + response = self.client.runtime_environments.delete( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_runtime_environments_list_by_automation_account(self, resource_group): + response = self.client.runtime_environments.list_by_automation_account( + resource_group_name=resource_group.name, + automation_account_name="str", + ) + 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_runtime_environments_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runtime_environments_operations_async.py new file mode 100644 index 000000000000..a19e7829c9e3 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_runtime_environments_operations_async.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.automation.aio import AutomationClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestAutomationRuntimeEnvironmentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AutomationClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_runtime_environments_get(self, resource_group): + response = await self.client.runtime_environments.get( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_runtime_environments_create(self, resource_group): + response = await self.client.runtime_environments.create( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + parameters={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "defaultPackages": {"str": "str"}, + "description": "str", + "runtime": {"language": "str", "version": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_runtime_environments_update(self, resource_group): + response = await self.client.runtime_environments.update( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + parameters={ + "properties": {"defaultPackages": {"str": "str"}}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_runtime_environments_delete(self, resource_group): + response = await self.client.runtime_environments.delete( + resource_group_name=resource_group.name, + automation_account_name="str", + runtime_environment_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_runtime_environments_list_by_automation_account(self, resource_group): + response = self.client.runtime_environments.list_by_automation_account( + resource_group_name=resource_group.name, + automation_account_name="str", + ) + 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 92198821ba76..c8e9394efd34 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,26 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_schedule_create_or_update(self, resource_group): - response = self.client.schedule.create_or_update( + 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", - parameters={ - "frequency": "str", - "name": "str", - "startTime": "2020-02-20 00:00:00", - "advancedSchedule": { - "monthDays": [0], - "monthlyOccurrences": [{"day": "str", "occurrence": 0}], - "weekDays": ["str"], - }, - "description": "str", - "expiryTime": "2020-02-20 00:00:00", - "interval": {}, - "timeZone": "str", - }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -47,13 +32,27 @@ def test_schedule_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_schedule_update(self, resource_group): - response = self.client.schedule.update( + 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", schedule_name="str", - parameters={"description": "str", "isEnabled": bool, "name": "str"}, - api_version="2015-10-31", + parameters={ + "name": "str", + "properties": { + "frequency": "str", + "startTime": "2020-02-20 00:00:00", + "advancedSchedule": { + "monthDays": [0], + "monthlyOccurrences": [{"day": "str", "occurrence": 0}], + "weekDays": ["str"], + }, + "description": "str", + "expiryTime": "2020-02-20 00:00:00", + "interval": {}, + "timeZone": "str", + }, + }, ) # please add some check logic here by yourself @@ -61,12 +60,12 @@ def test_schedule_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_schedule_get(self, resource_group): - response = self.client.schedule.get( + 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", - api_version="2015-10-31", + parameters={"name": "str", "properties": {"description": "str", "isEnabled": bool}}, ) # please add some check logic here by yourself @@ -79,7 +78,6 @@ def test_schedule_delete(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", schedule_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -91,7 +89,6 @@ 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="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 7d99a6370a29..66e503358b1a 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,26 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_schedule_create_or_update(self, resource_group): - response = await self.client.schedule.create_or_update( + 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", - parameters={ - "frequency": "str", - "name": "str", - "startTime": "2020-02-20 00:00:00", - "advancedSchedule": { - "monthDays": [0], - "monthlyOccurrences": [{"day": "str", "occurrence": 0}], - "weekDays": ["str"], - }, - "description": "str", - "expiryTime": "2020-02-20 00:00:00", - "interval": {}, - "timeZone": "str", - }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -48,13 +33,27 @@ async def test_schedule_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_schedule_update(self, resource_group): - response = await self.client.schedule.update( + 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", schedule_name="str", - parameters={"description": "str", "isEnabled": bool, "name": "str"}, - api_version="2015-10-31", + parameters={ + "name": "str", + "properties": { + "frequency": "str", + "startTime": "2020-02-20 00:00:00", + "advancedSchedule": { + "monthDays": [0], + "monthlyOccurrences": [{"day": "str", "occurrence": 0}], + "weekDays": ["str"], + }, + "description": "str", + "expiryTime": "2020-02-20 00:00:00", + "interval": {}, + "timeZone": "str", + }, + }, ) # please add some check logic here by yourself @@ -62,12 +61,12 @@ async def test_schedule_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_schedule_get(self, resource_group): - response = await self.client.schedule.get( + 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", - api_version="2015-10-31", + parameters={"name": "str", "properties": {"description": "str", "isEnabled": bool}}, ) # please add some check logic here by yourself @@ -80,7 +79,6 @@ async def test_schedule_delete(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", schedule_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -92,7 +90,6 @@ 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="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 cd04efd3b001..dcc509980f9f 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ def test_software_update_configuration_machine_runs_get_by_id(self, resource_gro resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_machine_run_id="str", - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -37,7 +36,6 @@ 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="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 6f9aed3f146d..0bb01268d3c0 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ async def test_software_update_configuration_machine_runs_get_by_id(self, resour resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_machine_run_id="str", - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -38,7 +37,6 @@ async def test_software_update_configuration_machine_runs_list(self, resource_gr response = await self.client.software_update_configuration_machine_runs.list( resource_group_name=resource_group.name, automation_account_name="str", - 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 42cb2f36c140..7c1b4d8c1aa7 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ def test_software_update_configuration_runs_get_by_id(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_run_id="str", - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -37,7 +36,6 @@ 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="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 5d76a3121b96..74ce4be5c8c6 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ async def test_software_update_configuration_runs_get_by_id(self, resource_group resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_run_id="str", - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -38,7 +37,6 @@ 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="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 4f65d47c85bb..20bd4077acb1 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,6 +18,18 @@ class TestAutomationSoftwareUpdateConfigurationsOperations(AzureMgmtRecordedTest def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_software_update_configurations_create(self, resource_group): @@ -26,82 +38,78 @@ def test_software_update_configurations_create(self, resource_group): automation_account_name="str", software_update_configuration_name="str", parameters={ - "scheduleInfo": { - "advancedSchedule": { - "monthDays": [0], - "monthlyOccurrences": [{"day": "str", "occurrence": 0}], - "weekDays": ["str"], + "properties": { + "scheduleInfo": { + "advancedSchedule": { + "monthDays": [0], + "monthlyOccurrences": [{"day": "str", "occurrence": 0}], + "weekDays": ["str"], + }, + "creationTime": "2020-02-20 00:00:00", + "description": "str", + "expiryTime": "2020-02-20 00:00:00", + "expiryTimeOffsetMinutes": 0.0, + "frequency": "str", + "interval": 0, + "isEnabled": bool, + "lastModifiedTime": "2020-02-20 00:00:00", + "nextRun": "2020-02-20 00:00:00", + "nextRunOffsetMinutes": 0.0, + "startTime": "2020-02-20 00:00:00", + "startTimeOffsetMinutes": 0.0, + "timeZone": "str", + }, + "updateConfiguration": { + "operatingSystem": "str", + "azureVirtualMachines": ["str"], + "duration": "1 day, 0:00:00", + "linux": { + "excludedPackageNameMasks": ["str"], + "includedPackageClassifications": "str", + "includedPackageNameMasks": ["str"], + "rebootSetting": "str", + }, + "nonAzureComputerNames": ["str"], + "targets": { + "azureQueries": [ + { + "locations": ["str"], + "scope": ["str"], + "tagSettings": {"filterOperator": "str", "tags": {"str": ["str"]}}, + } + ], + "nonAzureQueries": [{"functionAlias": "str", "workspaceId": "str"}], + }, + "windows": { + "excludedKbNumbers": ["str"], + "includedKbNumbers": ["str"], + "includedUpdateClassifications": "str", + "rebootSetting": "str", + }, }, + "createdBy": "str", "creationTime": "2020-02-20 00:00:00", - "description": "str", - "expiryTime": "2020-02-20 00:00:00", - "expiryTimeOffsetMinutes": 0.0, - "frequency": "str", - "interval": 0, - "isEnabled": False, + "error": {"code": "str", "message": "str"}, + "lastModifiedBy": "str", "lastModifiedTime": "2020-02-20 00:00:00", - "nextRun": "2020-02-20 00:00:00", - "nextRunOffsetMinutes": 0.0, - "startTime": "2020-02-20 00:00:00", - "startTimeOffsetMinutes": 0.0, - "timeZone": "str", - }, - "updateConfiguration": { - "operatingSystem": "str", - "azureVirtualMachines": ["str"], - "duration": "1 day, 0:00:00", - "linux": { - "excludedPackageNameMasks": ["str"], - "includedPackageClassifications": "str", - "includedPackageNameMasks": ["str"], - "rebootSetting": "str", - }, - "nonAzureComputerNames": ["str"], - "targets": { - "azureQueries": [ - { - "locations": ["str"], - "scope": ["str"], - "tagSettings": {"filterOperator": "str", "tags": {"str": ["str"]}}, - } - ], - "nonAzureQueries": [{"functionAlias": "str", "workspaceId": "str"}], - }, - "windows": { - "excludedKbNumbers": ["str"], - "includedKbNumbers": ["str"], - "includedUpdateClassifications": "str", - "rebootSetting": "str", + "provisioningState": "str", + "tasks": { + "postTask": {"parameters": {"str": "str"}, "source": "str"}, + "preTask": {"parameters": {"str": "str"}, "source": "str"}, }, }, - "createdBy": "str", - "creationTime": "2020-02-20 00:00:00", - "error": {"code": "str", "message": "str"}, "id": "str", - "lastModifiedBy": "str", - "lastModifiedTime": "2020-02-20 00:00:00", "name": "str", - "provisioningState": "str", - "tasks": { - "postTask": {"parameters": {"str": "str"}, "source": "str"}, - "preTask": {"parameters": {"str": "str"}, "source": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", }, "type": "str", }, - api_version="2017-05-15-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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="2017-05-15-preview", ) # please add some check logic here by yourself @@ -114,7 +122,6 @@ def test_software_update_configurations_delete(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_name="str", - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -126,7 +133,6 @@ 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="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 a9b92480d4a0..057d290dba42 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,6 +19,18 @@ class TestAutomationSoftwareUpdateConfigurationsOperationsAsync(AzureMgmtRecorde def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_software_update_configurations_create(self, resource_group): @@ -27,82 +39,78 @@ async def test_software_update_configurations_create(self, resource_group): automation_account_name="str", software_update_configuration_name="str", parameters={ - "scheduleInfo": { - "advancedSchedule": { - "monthDays": [0], - "monthlyOccurrences": [{"day": "str", "occurrence": 0}], - "weekDays": ["str"], + "properties": { + "scheduleInfo": { + "advancedSchedule": { + "monthDays": [0], + "monthlyOccurrences": [{"day": "str", "occurrence": 0}], + "weekDays": ["str"], + }, + "creationTime": "2020-02-20 00:00:00", + "description": "str", + "expiryTime": "2020-02-20 00:00:00", + "expiryTimeOffsetMinutes": 0.0, + "frequency": "str", + "interval": 0, + "isEnabled": bool, + "lastModifiedTime": "2020-02-20 00:00:00", + "nextRun": "2020-02-20 00:00:00", + "nextRunOffsetMinutes": 0.0, + "startTime": "2020-02-20 00:00:00", + "startTimeOffsetMinutes": 0.0, + "timeZone": "str", + }, + "updateConfiguration": { + "operatingSystem": "str", + "azureVirtualMachines": ["str"], + "duration": "1 day, 0:00:00", + "linux": { + "excludedPackageNameMasks": ["str"], + "includedPackageClassifications": "str", + "includedPackageNameMasks": ["str"], + "rebootSetting": "str", + }, + "nonAzureComputerNames": ["str"], + "targets": { + "azureQueries": [ + { + "locations": ["str"], + "scope": ["str"], + "tagSettings": {"filterOperator": "str", "tags": {"str": ["str"]}}, + } + ], + "nonAzureQueries": [{"functionAlias": "str", "workspaceId": "str"}], + }, + "windows": { + "excludedKbNumbers": ["str"], + "includedKbNumbers": ["str"], + "includedUpdateClassifications": "str", + "rebootSetting": "str", + }, }, + "createdBy": "str", "creationTime": "2020-02-20 00:00:00", - "description": "str", - "expiryTime": "2020-02-20 00:00:00", - "expiryTimeOffsetMinutes": 0.0, - "frequency": "str", - "interval": 0, - "isEnabled": False, + "error": {"code": "str", "message": "str"}, + "lastModifiedBy": "str", "lastModifiedTime": "2020-02-20 00:00:00", - "nextRun": "2020-02-20 00:00:00", - "nextRunOffsetMinutes": 0.0, - "startTime": "2020-02-20 00:00:00", - "startTimeOffsetMinutes": 0.0, - "timeZone": "str", - }, - "updateConfiguration": { - "operatingSystem": "str", - "azureVirtualMachines": ["str"], - "duration": "1 day, 0:00:00", - "linux": { - "excludedPackageNameMasks": ["str"], - "includedPackageClassifications": "str", - "includedPackageNameMasks": ["str"], - "rebootSetting": "str", - }, - "nonAzureComputerNames": ["str"], - "targets": { - "azureQueries": [ - { - "locations": ["str"], - "scope": ["str"], - "tagSettings": {"filterOperator": "str", "tags": {"str": ["str"]}}, - } - ], - "nonAzureQueries": [{"functionAlias": "str", "workspaceId": "str"}], - }, - "windows": { - "excludedKbNumbers": ["str"], - "includedKbNumbers": ["str"], - "includedUpdateClassifications": "str", - "rebootSetting": "str", + "provisioningState": "str", + "tasks": { + "postTask": {"parameters": {"str": "str"}, "source": "str"}, + "preTask": {"parameters": {"str": "str"}, "source": "str"}, }, }, - "createdBy": "str", - "creationTime": "2020-02-20 00:00:00", - "error": {"code": "str", "message": "str"}, "id": "str", - "lastModifiedBy": "str", - "lastModifiedTime": "2020-02-20 00:00:00", "name": "str", - "provisioningState": "str", - "tasks": { - "postTask": {"parameters": {"str": "str"}, "source": "str"}, - "preTask": {"parameters": {"str": "str"}, "source": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", }, "type": "str", }, - api_version="2017-05-15-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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="2017-05-15-preview", ) # please add some check logic here by yourself @@ -115,7 +123,6 @@ async def test_software_update_configurations_delete(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", software_update_configuration_name="str", - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -127,7 +134,6 @@ 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="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 105303ca9600..07a96f27d99d 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,22 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_source_control_create_or_update(self, resource_group): - response = self.client.source_control.create_or_update( + 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", - parameters={ - "autoSync": bool, - "branch": "str", - "description": "str", - "folderPath": "str", - "publishRunbook": bool, - "repoUrl": "str", - "securityToken": {"accessToken": "str", "refreshToken": "str", "tokenType": "str"}, - "sourceType": "str", - }, - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -43,20 +32,23 @@ def test_source_control_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_source_control_update(self, resource_group): - response = self.client.source_control.update( + 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", source_control_name="str", parameters={ - "autoSync": bool, - "branch": "str", - "description": "str", - "folderPath": "str", - "publishRunbook": bool, - "securityToken": {"accessToken": "str", "refreshToken": "str", "tokenType": "str"}, + "properties": { + "autoSync": bool, + "branch": "str", + "description": "str", + "folderPath": "str", + "publishRunbook": bool, + "repoUrl": "str", + "securityToken": {"accessToken": "str", "refreshToken": "str", "tokenType": "str"}, + "sourceType": "str", + } }, - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -64,12 +56,21 @@ def test_source_control_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_source_control_delete(self, resource_group): - response = self.client.source_control.delete( + def test_source_control_update(self, resource_group): + response = self.client.source_control.update( resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", - api_version="2017-05-15-preview", + parameters={ + "properties": { + "autoSync": bool, + "branch": "str", + "description": "str", + "folderPath": "str", + "publishRunbook": bool, + "securityToken": {"accessToken": "str", "refreshToken": "str", "tokenType": "str"}, + } + }, ) # please add some check logic here by yourself @@ -77,12 +78,11 @@ def test_source_control_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_source_control_get(self, resource_group): - response = self.client.source_control.get( + 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="2017-05-15-preview", ) # please add some check logic here by yourself @@ -94,7 +94,6 @@ 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="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 63ea7fa733e4..8d2c60bf4d17 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,22 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_source_control_create_or_update(self, resource_group): - response = await self.client.source_control.create_or_update( + 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", - parameters={ - "autoSync": bool, - "branch": "str", - "description": "str", - "folderPath": "str", - "publishRunbook": bool, - "repoUrl": "str", - "securityToken": {"accessToken": "str", "refreshToken": "str", "tokenType": "str"}, - "sourceType": "str", - }, - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -44,20 +33,23 @@ async def test_source_control_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_source_control_update(self, resource_group): - response = await self.client.source_control.update( + 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", source_control_name="str", parameters={ - "autoSync": bool, - "branch": "str", - "description": "str", - "folderPath": "str", - "publishRunbook": bool, - "securityToken": {"accessToken": "str", "refreshToken": "str", "tokenType": "str"}, + "properties": { + "autoSync": bool, + "branch": "str", + "description": "str", + "folderPath": "str", + "publishRunbook": bool, + "repoUrl": "str", + "securityToken": {"accessToken": "str", "refreshToken": "str", "tokenType": "str"}, + "sourceType": "str", + } }, - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -65,12 +57,21 @@ async def test_source_control_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_source_control_delete(self, resource_group): - response = await self.client.source_control.delete( + 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", source_control_name="str", - api_version="2017-05-15-preview", + parameters={ + "properties": { + "autoSync": bool, + "branch": "str", + "description": "str", + "folderPath": "str", + "publishRunbook": bool, + "securityToken": {"accessToken": "str", "refreshToken": "str", "tokenType": "str"}, + } + }, ) # please add some check logic here by yourself @@ -78,12 +79,11 @@ async def test_source_control_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_source_control_get(self, resource_group): - response = await self.client.source_control.get( + 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="2017-05-15-preview", ) # please add some check logic here by yourself @@ -95,7 +95,6 @@ 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="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 1603126678e0..b149dd59dd32 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,8 +26,7 @@ def test_source_control_sync_job_create(self, resource_group): automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", - parameters={"commitId": "str"}, - api_version="2017-05-15-preview", + parameters={"properties": {"commitId": "str"}}, ) # please add some check logic here by yourself @@ -41,7 +40,6 @@ def test_source_control_sync_job_get(self, resource_group): automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -54,7 +52,6 @@ def test_source_control_sync_job_list_by_automation_account(self, resource_group resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", - 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 17b679ca38fb..47861feee042 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -27,8 +27,7 @@ async def test_source_control_sync_job_create(self, resource_group): automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", - parameters={"commitId": "str"}, - api_version="2017-05-15-preview", + parameters={"properties": {"commitId": "str"}}, ) # please add some check logic here by yourself @@ -42,7 +41,6 @@ async def test_source_control_sync_job_get(self, resource_group): automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", - api_version="2017-05-15-preview", ) # please add some check logic here by yourself @@ -55,7 +53,6 @@ async def test_source_control_sync_job_list_by_automation_account(self, resource resource_group_name=resource_group.name, automation_account_name="str", source_control_name="str", - 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 38d245605d4c..ee8834f9d48e 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ def test_source_control_sync_job_streams_list_by_sync_job(self, resource_group): automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", - api_version="2017-05-15-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -41,7 +40,6 @@ def test_source_control_sync_job_streams_get(self, resource_group): source_control_name="str", source_control_sync_job_id="str", stream_id="str", - 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 4bd7111ab8eb..5aea0a18e244 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -27,7 +27,6 @@ async def test_source_control_sync_job_streams_list_by_sync_job(self, resource_g automation_account_name="str", source_control_name="str", source_control_sync_job_id="str", - api_version="2017-05-15-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -42,7 +41,6 @@ async def test_source_control_sync_job_streams_get(self, resource_group): source_control_name="str", source_control_sync_job_id="str", stream_id="str", - 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 00af04bc56c7..6c27e54b9864 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ 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="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 fc8be9dafb5d..08177dce7a32 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ 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="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 8d54cbcab659..1e0b045db1dc 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,8 +25,7 @@ def test_test_job_create(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - parameters={"parameters": {"str": "str"}, "runOn": "str"}, - api_version="2018-06-30", + parameters={"parameters": {"str": "str"}, "runOn": "str", "runtimeEnvironment": "str"}, ) # please add some check logic here by yourself @@ -39,7 +38,6 @@ def test_test_job_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -52,7 +50,6 @@ def test_test_job_resume(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -65,7 +62,6 @@ def test_test_job_stop(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -78,7 +74,6 @@ def test_test_job_suspend(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - 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 5e9b12dd41a9..962ddb7f0163 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,8 +26,7 @@ async def test_test_job_create(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - parameters={"parameters": {"str": "str"}, "runOn": "str"}, - api_version="2018-06-30", + parameters={"parameters": {"str": "str"}, "runOn": "str", "runtimeEnvironment": "str"}, ) # please add some check logic here by yourself @@ -40,7 +39,6 @@ async def test_test_job_get(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -53,7 +51,6 @@ async def test_test_job_resume(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -66,7 +63,6 @@ async def test_test_job_stop(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -79,7 +75,6 @@ async def test_test_job_suspend(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - 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 1d8ca8001a87..f53f22f2d90d 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ def test_test_job_streams_get(self, resource_group): automation_account_name="str", runbook_name="str", job_stream_id="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -39,7 +38,6 @@ def test_test_job_streams_list_by_test_job(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - 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 25ff39043237..e7dda87652c5 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -27,7 +27,6 @@ async def test_test_job_streams_get(self, resource_group): automation_account_name="str", runbook_name="str", job_stream_id="str", - api_version="2018-06-30", ) # please add some check logic here by yourself @@ -40,7 +39,6 @@ async def test_test_job_streams_list_by_test_job(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", runbook_name="str", - 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 7677f2c1a2d6..560401e41f23 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ 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="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 9a145ec1f035..3071f7339d6d 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ 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="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 9d44dc5253ac..84cb3e0c2846 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,13 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_variable_create_or_update(self, resource_group): - response = self.client.variable.create_or_update( + 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", - parameters={"name": "str", "description": "str", "isEncrypted": bool, "value": "str"}, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -34,13 +32,12 @@ def test_variable_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_variable_update(self, resource_group): - response = self.client.variable.update( + 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={"description": "str", "name": "str", "value": "str"}, - api_version="2015-10-31", + parameters={"name": "str", "properties": {"description": "str", "isEncrypted": bool, "value": "str"}}, ) # please add some check logic here by yourself @@ -48,12 +45,12 @@ def test_variable_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_variable_delete(self, resource_group): - response = self.client.variable.delete( + 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", - api_version="2015-10-31", + parameters={"name": "str", "properties": {"description": "str", "value": "str"}}, ) # please add some check logic here by yourself @@ -61,12 +58,11 @@ def test_variable_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_variable_get(self, resource_group): - response = self.client.variable.get( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -78,7 +74,6 @@ 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="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 9b3eab48e163..3733318fafaf 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,13 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_variable_create_or_update(self, resource_group): - response = await self.client.variable.create_or_update( + 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", - parameters={"name": "str", "description": "str", "isEncrypted": bool, "value": "str"}, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -35,13 +33,12 @@ async def test_variable_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_variable_update(self, resource_group): - response = await self.client.variable.update( + 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={"description": "str", "name": "str", "value": "str"}, - api_version="2015-10-31", + parameters={"name": "str", "properties": {"description": "str", "isEncrypted": bool, "value": "str"}}, ) # please add some check logic here by yourself @@ -49,12 +46,12 @@ async def test_variable_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_variable_delete(self, resource_group): - response = await self.client.variable.delete( + 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", - api_version="2015-10-31", + parameters={"name": "str", "properties": {"description": "str", "value": "str"}}, ) # please add some check logic here by yourself @@ -62,12 +59,11 @@ async def test_variable_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_variable_get(self, resource_group): - response = await self.client.variable.get( + 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="2015-10-31", ) # please add some check logic here by yourself @@ -79,7 +75,6 @@ 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="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 fc3001bd1570..31c25efbd738 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,6 +18,18 @@ class TestAutomationWatcherOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_watcher_create_or_update(self, resource_group): @@ -26,23 +38,32 @@ def test_watcher_create_or_update(self, resource_group): automation_account_name="str", watcher_name="str", parameters={ - "creationTime": "2020-02-20 00:00:00", - "description": "str", "etag": "str", - "executionFrequencyInSeconds": 0, "id": "str", - "lastModifiedBy": "str", - "lastModifiedTime": "2020-02-20 00:00:00", "location": "str", "name": "str", - "scriptName": "str", - "scriptParameters": {"str": "str"}, - "scriptRunOn": "str", - "status": "str", + "properties": { + "creationTime": "2020-02-20 00:00:00", + "description": "str", + "executionFrequencyInSeconds": 0, + "lastModifiedBy": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "scriptName": "str", + "scriptParameters": {"str": "str"}, + "scriptRunOn": "str", + "status": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "tags": {"str": "str"}, "type": "str", }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -50,12 +71,12 @@ def test_watcher_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_watcher_get(self, resource_group): - response = self.client.watcher.get( + 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", - api_version="2015-10-31", + parameters={"name": "str", "properties": {"executionFrequencyInSeconds": 0}}, ) # please add some check logic here by yourself @@ -63,13 +84,11 @@ def test_watcher_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_watcher_update(self, resource_group): - response = self.client.watcher.update( + 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", - parameters={"executionFrequencyInSeconds": 0, "name": "str"}, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -77,14 +96,12 @@ def test_watcher_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_watcher_delete(self, resource_group): - response = self.client.watcher.delete( + 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", - watcher_name="str", - api_version="2015-10-31", ) - + result = [r for r in response] # please add some check logic here by yourself # ... @@ -95,7 +112,6 @@ def test_watcher_start(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -108,20 +124,7 @@ def test_watcher_stop(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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="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 5664d4fa20d9..7229fec98605 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,6 +19,18 @@ class TestAutomationWatcherOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(AutomationClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_watcher_create_or_update(self, resource_group): @@ -27,23 +39,32 @@ async def test_watcher_create_or_update(self, resource_group): automation_account_name="str", watcher_name="str", parameters={ - "creationTime": "2020-02-20 00:00:00", - "description": "str", "etag": "str", - "executionFrequencyInSeconds": 0, "id": "str", - "lastModifiedBy": "str", - "lastModifiedTime": "2020-02-20 00:00:00", "location": "str", "name": "str", - "scriptName": "str", - "scriptParameters": {"str": "str"}, - "scriptRunOn": "str", - "status": "str", + "properties": { + "creationTime": "2020-02-20 00:00:00", + "description": "str", + "executionFrequencyInSeconds": 0, + "lastModifiedBy": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "scriptName": "str", + "scriptParameters": {"str": "str"}, + "scriptRunOn": "str", + "status": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "tags": {"str": "str"}, "type": "str", }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -51,12 +72,12 @@ async def test_watcher_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_watcher_get(self, resource_group): - response = await self.client.watcher.get( + 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", - api_version="2015-10-31", + parameters={"name": "str", "properties": {"executionFrequencyInSeconds": 0}}, ) # please add some check logic here by yourself @@ -64,13 +85,11 @@ async def test_watcher_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_watcher_update(self, resource_group): - response = await self.client.watcher.update( + 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", - parameters={"executionFrequencyInSeconds": 0, "name": "str"}, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -78,14 +97,12 @@ async def test_watcher_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_watcher_delete(self, resource_group): - response = await self.client.watcher.delete( + 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", - watcher_name="str", - api_version="2015-10-31", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... @@ -96,7 +113,6 @@ async def test_watcher_start(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -109,20 +125,7 @@ async def test_watcher_stop(self, resource_group): resource_group_name=resource_group.name, automation_account_name="str", watcher_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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="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 900eb9ec3a51..1d45a00b6f1f 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ def test_webhook_generate_uri(self, resource_group): response = self.client.webhook.generate_uri( resource_group_name=resource_group.name, automation_account_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -32,12 +31,11 @@ def test_webhook_generate_uri(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_webhook_delete(self, resource_group): - response = self.client.webhook.delete( + def test_webhook_get(self, resource_group): + response = self.client.webhook.get( resource_group_name=resource_group.name, automation_account_name="str", webhook_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -45,12 +43,22 @@ def test_webhook_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_webhook_get(self, resource_group): - response = self.client.webhook.get( + 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", webhook_name="str", - api_version="2015-10-31", + parameters={ + "name": "str", + "properties": { + "expiryTime": "2020-02-20 00:00:00", + "isEnabled": bool, + "parameters": {"str": "str"}, + "runOn": "str", + "runbook": {"name": "str"}, + "uri": "str", + }, + }, ) # please add some check logic here by yourself @@ -58,21 +66,15 @@ def test_webhook_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_webhook_create_or_update(self, resource_group): - response = self.client.webhook.create_or_update( + def test_webhook_update(self, resource_group): + response = self.client.webhook.update( resource_group_name=resource_group.name, automation_account_name="str", webhook_name="str", parameters={ "name": "str", - "expiryTime": "2020-02-20 00:00:00", - "isEnabled": bool, - "parameters": {"str": "str"}, - "runOn": "str", - "runbook": {"name": "str"}, - "uri": "str", + "properties": {"description": "str", "isEnabled": bool, "parameters": {"str": "str"}, "runOn": "str"}, }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -80,19 +82,11 @@ def test_webhook_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_webhook_update(self, resource_group): - response = self.client.webhook.update( + def test_webhook_delete(self, resource_group): + response = self.client.webhook.delete( resource_group_name=resource_group.name, automation_account_name="str", webhook_name="str", - parameters={ - "description": "str", - "isEnabled": bool, - "name": "str", - "parameters": {"str": "str"}, - "runOn": "str", - }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -104,7 +98,6 @@ 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", - 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_webhook_operations_async.py b/sdk/automation/azure-mgmt-automation/generated_tests/test_automation_webhook_operations_async.py index 69487bfcfb79..e5494a844e2f 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ 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", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -33,12 +32,11 @@ async def test_webhook_generate_uri(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_webhook_delete(self, resource_group): - response = await self.client.webhook.delete( + async def test_webhook_get(self, resource_group): + response = await self.client.webhook.get( resource_group_name=resource_group.name, automation_account_name="str", webhook_name="str", - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -46,12 +44,22 @@ async def test_webhook_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_webhook_get(self, resource_group): - response = await self.client.webhook.get( + 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", webhook_name="str", - api_version="2015-10-31", + parameters={ + "name": "str", + "properties": { + "expiryTime": "2020-02-20 00:00:00", + "isEnabled": bool, + "parameters": {"str": "str"}, + "runOn": "str", + "runbook": {"name": "str"}, + "uri": "str", + }, + }, ) # please add some check logic here by yourself @@ -59,21 +67,15 @@ async def test_webhook_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_webhook_create_or_update(self, resource_group): - response = await self.client.webhook.create_or_update( + async def test_webhook_update(self, resource_group): + response = await self.client.webhook.update( resource_group_name=resource_group.name, automation_account_name="str", webhook_name="str", parameters={ "name": "str", - "expiryTime": "2020-02-20 00:00:00", - "isEnabled": bool, - "parameters": {"str": "str"}, - "runOn": "str", - "runbook": {"name": "str"}, - "uri": "str", + "properties": {"description": "str", "isEnabled": bool, "parameters": {"str": "str"}, "runOn": "str"}, }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -81,19 +83,11 @@ async def test_webhook_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_webhook_update(self, resource_group): - response = await self.client.webhook.update( + async def test_webhook_delete(self, resource_group): + response = await self.client.webhook.delete( resource_group_name=resource_group.name, automation_account_name="str", webhook_name="str", - parameters={ - "description": "str", - "isEnabled": bool, - "name": "str", - "parameters": {"str": "str"}, - "runOn": "str", - }, - api_version="2015-10-31", ) # please add some check logic here by yourself @@ -105,7 +99,6 @@ 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", - 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/pyproject.toml b/sdk/automation/azure-mgmt-automation/pyproject.toml index 44cd995b73e1..36c71c43ac59 100644 --- a/sdk/automation/azure-mgmt-automation/pyproject.toml +++ b/sdk/automation/azure-mgmt-automation/pyproject.toml @@ -13,17 +13,16 @@ authors = [ description = "Microsoft Azure Automation Management Client Library for Python" license = "MIT" classifiers = [ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "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" +requires-python = ">=3.10" keywords = [ "azure", "azure sdk", @@ -78,7 +77,7 @@ verifytypes = false package_name = "azure-mgmt-automation" package_pprint_name = "Automation" package_doc_id = "" -is_stable = true +is_stable = false is_arm = true title = "AutomationClient" package_nspkg = "azure-mgmt-nspkg" diff --git a/sdk/automation/azure-mgmt-automation/tests/test_mgmt_runbook_test.py b/sdk/automation/azure-mgmt-automation/tests/test_mgmt_runbook_test.py index f48ccf50edee..42266df90f50 100644 --- a/sdk/automation/azure-mgmt-automation/tests/test_mgmt_runbook_test.py +++ b/sdk/automation/azure-mgmt-automation/tests/test_mgmt_runbook_test.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression from azure.mgmt.automation import AutomationClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy import pytest diff --git a/sdk/automation/azure-mgmt-automation/tsp-location.yaml b/sdk/automation/azure-mgmt-automation/tsp-location.yaml new file mode 100644 index 000000000000..284b76cc324d --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/automation/Automation.Management +commit: da8db6e593df9f3ddc13139c39930fdad54d12f7 +repo: Azure/azure-rest-api-specs +additionalDirectories: From ff42d9a8ff7cdb9c38481c52ed2b9b200d3a59f4 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 27 May 2026 18:12:27 +0800 Subject: [PATCH 2/4] Optimize changelog for azure-mgmt-automation --- .../azure-mgmt-automation/CHANGELOG.md | 239 ++++-------------- 1 file changed, 46 insertions(+), 193 deletions(-) diff --git a/sdk/automation/azure-mgmt-automation/CHANGELOG.md b/sdk/automation/azure-mgmt-automation/CHANGELOG.md index 12cba94cf282..16fe0861add0 100644 --- a/sdk/automation/azure-mgmt-automation/CHANGELOG.md +++ b/sdk/automation/azure-mgmt-automation/CHANGELOG.md @@ -8,89 +8,41 @@ - Client `AutomationClient` added method `send_request` - Client `AutomationClient` added operation group `runtime_environments` - Client `AutomationClient` added operation group `package` - - Model `AgentRegistration` added property `keys_property` - - Model `AutomationAccountCreateOrUpdateParameters` added property `properties` - - Model `AutomationAccountUpdateParameters` added property `properties` - Model `Certificate` added property `system_data` - - Model `CertificateCreateOrUpdateParameters` added property `properties` - - Model `CertificateUpdateParameters` added property `properties` - Model `Connection` added property `system_data` - - Model `ConnectionCreateOrUpdateParameters` added property `properties` - Model `ConnectionType` added property `system_data` - - Model `ConnectionTypeCreateOrUpdateParameters` added property `properties` - - Model `ConnectionUpdateParameters` added property `properties` - Model `Credential` added property `system_data` - - Model `CredentialCreateOrUpdateParameters` added property `properties` - - Model `CredentialUpdateParameters` added property `properties` - Model `DscConfiguration` added property `system_data` - - Model `DscConfigurationCreateOrUpdateParameters` added property `properties` - - Model `DscConfigurationUpdateParameters` added property `properties` - Model `DscNode` added property `system_data` - Model `DscNodeConfiguration` added property `system_data` - Model `HybridRunbookWorker` added property `tags` - Model `HybridRunbookWorker` added property `location` - - Model `HybridRunbookWorkerCreateParameters` added property `properties` - Model `HybridRunbookWorkerGroup` added property `tags` - Model `HybridRunbookWorkerGroup` added property `location` - - Model `HybridRunbookWorkerGroupCreateOrUpdateParameters` added property `properties` - Model `Job` added property `system_data` - Model `JobCollectionItem` added property `system_data` - Model `JobSchedule` added property `system_data` - Model `Module` added property `system_data` - - Model `ModuleCreateOrUpdateParameters` added property `properties` - - Enum `ModuleProvisioningState` added member `CANCELED` - - Model `ModuleUpdateParameters` added property `properties` - - Model `Operation` added property `properties` - Model `PrivateEndpointConnection` added property `system_data` - Model `PrivateLinkResource` added property `system_data` - Model `ProxyResource` added property `system_data` - - Model `PythonPackageCreateParameters` added property `properties` - Model `Resource` added property `system_data` - Model `Runbook` added property `system_data` - - Model `RunbookCreateOrUpdateParameters` added property `properties` - Enum `RunbookTypeEnum` added member `POWER_SHELL72` - Enum `RunbookTypeEnum` added member `PYTHON` - - Model `RunbookUpdateParameters` added property `properties` - Model `Schedule` added property `system_data` - - Model `ScheduleCreateOrUpdateParameters` added property `properties` - - Model `ScheduleUpdateParameters` added property `properties` - Model `SoftwareUpdateConfiguration` added property `system_data` - - Model `SoftwareUpdateConfigurationMachineRun` added property `properties` - Model `SourceControl` added property `system_data` - Model `TestJobCreateParameters` added property `runtime_environment` - Model `TrackedResource` added property `system_data` - Model `Variable` added property `system_data` - - Model `VariableCreateOrUpdateParameters` added property `properties` - - Model `VariableUpdateParameters` added property `properties` - Model `Watcher` added property `system_data` - - Model `WatcherUpdateParameters` added property `properties` - Model `Webhook` added property `system_data` - - Model `WebhookCreateOrUpdateParameters` added property `properties` - - Model `WebhookUpdateParameters` added property `properties` - - Added model `AutomationAccountCreateOrUpdateProperties` - - Added model `AutomationAccountUpdateProperties` - Added model `AutomationErrorResponse` - - Added model `CertificateCreateOrUpdateProperties` - - Added model `CertificateUpdateProperties` - - Added model `ConnectionCreateOrUpdateProperties` - - Added model `ConnectionTypeCreateOrUpdateProperties` - - Added model `ConnectionUpdateProperties` - - Added model `CredentialCreateOrUpdateProperties` - - Added model `CredentialUpdateProperties` - Added model `DeletedRunbook` - Added model `DeletedRunbookProperties` - - Added model `DscConfigurationCreateOrUpdateProperties` - - Added model `DscNodeConfigurationAssociationProperty` - Added model `ErrorAdditionalInfo` - - Added model `ErrorDetail` - - Added model `HybridRunbookWorkerCreateOrUpdateParameters` - - Added model `HybridRunbookWorkerGroupCreateOrUpdateProperties` - - Added model `JobCreateProperties` - Added model `JobRuntimeEnvironment` - - Added model `JobScheduleCreateProperties` - - Added model `ModuleCreateOrUpdateProperties` - - Added model `ModuleUpdateProperties` - - Added model `OperationPropertiesFormat` - Added model `Package` - Added model `PackageCreateOrUpdateParameters` - Added model `PackageCreateOrUpdateProperties` @@ -99,162 +51,62 @@ - Added enum `PackageProvisioningState` - Added model `PackageUpdateParameters` - Added model `PackageUpdateProperties` - - Added model `PythonPackageCreateProperties` - - Added model `RunbookCreateOrUpdateProperties` - - Added model `RunbookUpdateProperties` - Added model `RuntimeEnvironment` - Added model `RuntimeEnvironmentProperties` - Added model `RuntimeEnvironmentUpdateParameters` - Added model `RuntimeEnvironmentUpdateProperties` - Added model `RuntimeProperties` - - Added model `ScheduleCreateOrUpdateProperties` - - Added model `ScheduleUpdateProperties` - - Added model `SourceControlCreateOrUpdateProperties` - - Added model `SourceControlSyncJobCreateProperties` - - Added model `SourceControlUpdateProperties` - - Added model `UpdateConfigurationMachineRunProperties` - - Added model `VariableCreateOrUpdateProperties` - - Added model `VariableUpdateProperties` - - Added model `WatcherUpdateProperties` - - Added model `WebhookCreateOrUpdateProperties` - - Added model `WebhookUpdateProperties` - - Model `AutomationAccountOperations` added method `list_deleted_runbooks` - - Model `HybridRunbookWorkersOperations` added method `patch` - - Added model `PackageOperations` - - Added model `RuntimeEnvironmentsOperations` + - Operation group `AutomationAccountOperations` added method `list_deleted_runbooks` + - Operation group `HybridRunbookWorkersOperations` added method `patch` + - Added operation group `PackageOperations` + - Added operation group `RuntimeEnvironmentsOperations` ### Breaking Changes + - This version introduces new hybrid models which have dual dictionary and model nature. Please follow https://aka.ms/azsdk/python/migrate/hybrid-models for migration. - Deleted or renamed client operation group `AutomationClient.dsc_compilation_job` - Deleted or renamed client operation group `AutomationClient.dsc_compilation_job_stream` - - Model `AgentRegistration` deleted or renamed its instance variable `keys` - - Model `AutomationAccountCreateOrUpdateParameters` deleted or renamed its instance variable `sku` - - Model `AutomationAccountCreateOrUpdateParameters` deleted or renamed its instance variable `encryption` - - Model `AutomationAccountCreateOrUpdateParameters` deleted or renamed its instance variable `public_network_access` - - Model `AutomationAccountCreateOrUpdateParameters` deleted or renamed its instance variable `disable_local_auth` - - Model `AutomationAccountUpdateParameters` deleted or renamed its instance variable `sku` - - Model `AutomationAccountUpdateParameters` deleted or renamed its instance variable `encryption` - - Model `AutomationAccountUpdateParameters` deleted or renamed its instance variable `public_network_access` - - Model `AutomationAccountUpdateParameters` deleted or renamed its instance variable `disable_local_auth` - - Model `CertificateCreateOrUpdateParameters` deleted or renamed its instance variable `base64_value` - - Model `CertificateCreateOrUpdateParameters` deleted or renamed its instance variable `description` - - Model `CertificateCreateOrUpdateParameters` deleted or renamed its instance variable `thumbprint` - - Model `CertificateCreateOrUpdateParameters` deleted or renamed its instance variable `is_exportable` - - Model `CertificateUpdateParameters` deleted or renamed its instance variable `description` - - Model `ConnectionCreateOrUpdateParameters` deleted or renamed its instance variable `description` - - Model `ConnectionCreateOrUpdateParameters` deleted or renamed its instance variable `connection_type` - - Model `ConnectionCreateOrUpdateParameters` deleted or renamed its instance variable `field_definition_values` - - Model `ConnectionTypeCreateOrUpdateParameters` deleted or renamed its instance variable `is_global` - - Model `ConnectionTypeCreateOrUpdateParameters` deleted or renamed its instance variable `field_definitions` - - Model `ConnectionUpdateParameters` deleted or renamed its instance variable `description` - - Model `ConnectionUpdateParameters` deleted or renamed its instance variable `field_definition_values` - - Model `CredentialCreateOrUpdateParameters` deleted or renamed its instance variable `user_name` - - Model `CredentialCreateOrUpdateParameters` deleted or renamed its instance variable `password` - - Model `CredentialCreateOrUpdateParameters` deleted or renamed its instance variable `description` - - Model `CredentialUpdateParameters` deleted or renamed its instance variable `user_name` - - Model `CredentialUpdateParameters` deleted or renamed its instance variable `password` - - Model `CredentialUpdateParameters` deleted or renamed its instance variable `description` - - Model `DscConfigurationCreateOrUpdateParameters` deleted or renamed its instance variable `log_verbose` - - Model `DscConfigurationCreateOrUpdateParameters` deleted or renamed its instance variable `log_progress` - - Model `DscConfigurationCreateOrUpdateParameters` deleted or renamed its instance variable `source` - - Model `DscConfigurationCreateOrUpdateParameters` deleted or renamed its instance variable `parameters` - - Model `DscConfigurationCreateOrUpdateParameters` deleted or renamed its instance variable `description` - - Model `DscConfigurationUpdateParameters` deleted or renamed its instance variable `log_verbose` - - Model `DscConfigurationUpdateParameters` deleted or renamed its instance variable `log_progress` - - Model `DscConfigurationUpdateParameters` deleted or renamed its instance variable `source` - - Model `DscConfigurationUpdateParameters` deleted or renamed its instance variable `parameters` - - Model `DscConfigurationUpdateParameters` deleted or renamed its instance variable `description` - - Model `DscNodeUpdateParametersProperties` deleted or renamed its instance variable `name` - - Model `ErrorResponse` deleted or renamed its instance variable `code` - - Model `ErrorResponse` deleted or renamed its instance variable `message` - - Model `HybridRunbookWorkerCreateParameters` deleted or renamed its instance variable `vm_resource_id` - - Model `HybridRunbookWorkerGroupCreateOrUpdateParameters` deleted or renamed its instance variable `credential` - - Model `JobCreateParameters` deleted or renamed its instance variable `runbook` - - Model `JobCreateParameters` deleted or renamed its instance variable `parameters` - - Model `JobCreateParameters` deleted or renamed its instance variable `run_on` - - Model `JobScheduleCreateParameters` deleted or renamed its instance variable `schedule` - - Model `JobScheduleCreateParameters` deleted or renamed its instance variable `runbook` - - Model `JobScheduleCreateParameters` deleted or renamed its instance variable `run_on` - - Model `JobScheduleCreateParameters` deleted or renamed its instance variable `parameters` - - Model `KeyListResult` deleted or renamed its instance variable `keys` - - Model `ModuleCreateOrUpdateParameters` deleted or renamed its instance variable `content_link` - - Deleted or renamed enum value `ModuleProvisioningState.CANCELLED` - - Model `ModuleUpdateParameters` deleted or renamed its instance variable `content_link` - - Model `Operation` deleted or renamed its instance variable `service_specification` - - Model `PythonPackageCreateParameters` deleted or renamed its instance variable `content_link` - - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `log_verbose` - - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `log_progress` - - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `runbook_type` - - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `draft` - - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `publish_content_link` - - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `description` - - Model `RunbookCreateOrUpdateParameters` deleted or renamed its instance variable `log_activity_trace` - - Model `RunbookUpdateParameters` deleted or renamed its instance variable `description` - - Model `RunbookUpdateParameters` deleted or renamed its instance variable `log_verbose` - - Model `RunbookUpdateParameters` deleted or renamed its instance variable `log_progress` - - Model `RunbookUpdateParameters` deleted or renamed its instance variable `log_activity_trace` - - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `description` - - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `start_time` - - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `expiry_time` - - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `interval` - - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `frequency` - - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `time_zone` - - Model `ScheduleCreateOrUpdateParameters` deleted or renamed its instance variable `advanced_schedule` - - Model `ScheduleUpdateParameters` deleted or renamed its instance variable `description` - - Model `ScheduleUpdateParameters` deleted or renamed its instance variable `is_enabled` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `target_computer` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `target_computer_type` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `software_update_configuration` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `status` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `os_type` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `correlation_id` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `source_computer_id` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `start_time` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `end_time` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `configured_duration` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `job` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `creation_time` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `created_by` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `last_modified_time` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `last_modified_by` - - Model `SoftwareUpdateConfigurationMachineRun` deleted or renamed its instance variable `error` - - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `repo_url` - - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `branch` - - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `folder_path` - - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `auto_sync` - - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `publish_runbook` - - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `source_type` - - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `security_token` - - Model `SourceControlCreateOrUpdateParameters` deleted or renamed its instance variable `description` - - Model `SourceControlSyncJobCreateParameters` deleted or renamed its instance variable `commit_id` - - Model `SourceControlUpdateParameters` deleted or renamed its instance variable `branch` - - Model `SourceControlUpdateParameters` deleted or renamed its instance variable `folder_path` - - Model `SourceControlUpdateParameters` deleted or renamed its instance variable `auto_sync` - - Model `SourceControlUpdateParameters` deleted or renamed its instance variable `publish_runbook` - - Model `SourceControlUpdateParameters` deleted or renamed its instance variable `security_token` - - Model `SourceControlUpdateParameters` deleted or renamed its instance variable `description` - - Model `VariableCreateOrUpdateParameters` deleted or renamed its instance variable `value` - - Model `VariableCreateOrUpdateParameters` deleted or renamed its instance variable `description` - - Model `VariableCreateOrUpdateParameters` deleted or renamed its instance variable `is_encrypted` - - Model `VariableUpdateParameters` deleted or renamed its instance variable `value` - - Model `VariableUpdateParameters` deleted or renamed its instance variable `description` - - Model `WatcherUpdateParameters` deleted or renamed its instance variable `execution_frequency_in_seconds` - - Model `WebhookCreateOrUpdateParameters` deleted or renamed its instance variable `is_enabled` - - Model `WebhookCreateOrUpdateParameters` deleted or renamed its instance variable `uri` - - Model `WebhookCreateOrUpdateParameters` deleted or renamed its instance variable `expiry_time` - - Model `WebhookCreateOrUpdateParameters` deleted or renamed its instance variable `parameters` - - Model `WebhookCreateOrUpdateParameters` deleted or renamed its instance variable `runbook` - - Model `WebhookCreateOrUpdateParameters` deleted or renamed its instance variable `run_on` - - Model `WebhookUpdateParameters` deleted or renamed its instance variable `is_enabled` - - Model `WebhookUpdateParameters` deleted or renamed its instance variable `run_on` - - Model `WebhookUpdateParameters` deleted or renamed its instance variable `parameters` - - Model `WebhookUpdateParameters` deleted or renamed its instance variable `description` + - Model `AgentRegistration` renamed its instance variable `keys` to `keys_property` + - Model `AutomationAccountCreateOrUpdateParameters` moved instance variable `sku`, `encryption`, `public_network_access` and `disable_local_auth` under property `properties` whose type is `AutomationAccountCreateOrUpdateProperties` + - Model `AutomationAccountUpdateParameters` moved instance variable `sku`, `encryption`, `public_network_access` and `disable_local_auth` under property `properties` whose type is `AutomationAccountUpdateProperties` + - Model `CertificateCreateOrUpdateParameters` moved instance variable `base64_value`, `description`, `thumbprint` and `is_exportable` under property `properties` whose type is `CertificateCreateOrUpdateProperties` + - Model `CertificateUpdateParameters` moved instance variable `description` under property `properties` whose type is `CertificateUpdateProperties` + - Model `ConnectionCreateOrUpdateParameters` moved instance variable `description`, `connection_type` and `field_definition_values` under property `properties` whose type is `ConnectionCreateOrUpdateProperties` + - Model `ConnectionTypeCreateOrUpdateParameters` moved instance variable `is_global` and `field_definitions` under property `properties` whose type is `ConnectionTypeCreateOrUpdateProperties` + - Model `ConnectionUpdateParameters` moved instance variable `description` and `field_definition_values` under property `properties` whose type is `ConnectionUpdateProperties` + - Model `CredentialCreateOrUpdateParameters` moved instance variable `user_name`, `password` and `description` under property `properties` whose type is `CredentialCreateOrUpdateProperties` + - Model `CredentialUpdateParameters` moved instance variable `user_name`, `password` and `description` under property `properties` whose type is `CredentialUpdateProperties` + - Model `DscConfigurationCreateOrUpdateParameters` moved instance variable `log_verbose`, `log_progress`, `source`, `parameters` and `description` under property `properties` whose type is `DscConfigurationCreateOrUpdateProperties` + - Model `DscConfigurationUpdateParameters` moved instance variable `log_verbose`, `log_progress`, `source`, `parameters` and `description` under property `properties` whose type is `DscConfigurationCreateOrUpdateProperties` + - Model `DscNodeUpdateParametersProperties` moved instance variable `name` under property `node_configuration` whose type is `DscNodeConfigurationAssociationProperty` + - Model `ErrorResponse` moved instance variable `code` and `message` under property `error` whose type is `ErrorDetail` + - Model `HybridRunbookWorkerCreateParameters` moved instance variable `vm_resource_id` under property `properties` whose type is `HybridRunbookWorkerCreateOrUpdateParameters` + - Model `HybridRunbookWorkerGroupCreateOrUpdateParameters` moved instance variable `credential` under property `properties` whose type is `HybridRunbookWorkerGroupCreateOrUpdateProperties` + - Model `JobCreateParameters` moved instance variable `runbook`, `parameters` and `run_on` under property `properties` whose type is `JobCreateProperties` + - Model `JobScheduleCreateParameters` moved instance variable `schedule`, `runbook`, `run_on` and `parameters` under property `properties` whose type is `JobScheduleCreateProperties` + - Model `KeyListResult` renamed its instance variable `keys` to `keys_property` + - Model `ModuleCreateOrUpdateParameters` moved instance variable `content_link` under property `properties` whose type is `ModuleCreateOrUpdateProperties` + - Renamed enum value `ModuleProvisioningState.CANCELLED` to `ModuleProvisioningState.CANCELED` + - Model `ModuleUpdateParameters` moved instance variable `content_link` under property `properties` whose type is `ModuleUpdateProperties` + - Model `Operation` moved instance variable `service_specification` under property `properties` whose type is `OperationPropertiesFormat` + - Model `PythonPackageCreateParameters` moved instance variable `content_link` under property `properties` whose type is `PythonPackageCreateProperties` + - Model `RunbookCreateOrUpdateParameters` moved instance variable `log_verbose`, `log_progress`, `runbook_type`, `draft`, `publish_content_link`, `description` and `log_activity_trace` under property `properties` whose type is `RunbookCreateOrUpdateProperties` + - Model `RunbookUpdateParameters` moved instance variable `description`, `log_verbose`, `log_progress` and `log_activity_trace` under property `properties` whose type is `RunbookUpdateProperties` + - Model `ScheduleCreateOrUpdateParameters` moved instance variable `description`, `start_time`, `expiry_time`, `interval`, `frequency`, `time_zone` and `advanced_schedule` under property `properties` whose type is `ScheduleCreateOrUpdateProperties` + - Model `ScheduleUpdateParameters` moved instance variable `description` and `is_enabled` under property `properties` whose type is `ScheduleUpdateProperties` + - Model `SoftwareUpdateConfigurationMachineRun` moved instance variable `target_computer`, `target_computer_type`, `software_update_configuration`, `status`, `os_type`, `correlation_id`, `source_computer_id`, `start_time`, `end_time`, `configured_duration`, `job`, `creation_time`, `created_by`, `last_modified_time`, `last_modified_by` and `error` under property `properties` whose type is `UpdateConfigurationMachineRunProperties` + - Model `SourceControlCreateOrUpdateParameters` moved instance variable `repo_url`, `branch`, `folder_path`, `auto_sync`, `publish_runbook`, `source_type`, `security_token` and `description` under property `properties` whose type is `SourceControlCreateOrUpdateProperties` + - Model `SourceControlSyncJobCreateParameters` moved instance variable `commit_id` under property `properties` whose type is `SourceControlSyncJobCreateProperties` + - Model `SourceControlUpdateParameters` moved instance variable `branch`, `folder_path`, `auto_sync`, `publish_runbook`, `security_token` and `description` under property `properties` whose type is `SourceControlUpdateProperties` + - Model `VariableCreateOrUpdateParameters` moved instance variable `value`, `description` and `is_encrypted` under property `properties` whose type is `VariableCreateOrUpdateProperties` + - Model `VariableUpdateParameters` moved instance variable `value` and `description` under property `properties` whose type is `VariableUpdateProperties` + - Model `WatcherUpdateParameters` moved instance variable `execution_frequency_in_seconds` under property `properties` whose type is `WatcherUpdateProperties` + - Model `WebhookCreateOrUpdateParameters` moved instance variable `is_enabled`, `uri`, `expiry_time`, `parameters`, `runbook` and `run_on` under property `properties` whose type is `WebhookCreateOrUpdateProperties` + - Model `WebhookUpdateParameters` moved instance variable `is_enabled`, `run_on`, `parameters` and `description` under property `properties` whose type is `WebhookUpdateProperties` - Deleted or renamed model `DscCompilationJob` - Deleted or renamed model `DscCompilationJobCreateParameters` - - Deleted or renamed model `JobListResultV2` - Deleted or renamed model `RunbookCreateOrUpdateDraftParameters` - Deleted or renamed model `RunbookCreateOrUpdateDraftProperties` - - Deleted or renamed model `SourceControlSyncJobStreamsListBySyncJob` - Method `DscConfigurationOperations.list_by_automation_account` changed its parameter `inlinecount` from `positional_or_keyword` to `keyword_only` - Method `DscNodeConfigurationOperations.list_by_automation_account` changed its parameter `inlinecount` from `positional_or_keyword` to `keyword_only` - Method `DscNodeOperations.list_by_automation_account` changed its parameter `inlinecount` from `positional_or_keyword` to `keyword_only` @@ -276,9 +128,6 @@ - Method `SoftwareUpdateConfigurationsOperations.delete` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` - Method `SoftwareUpdateConfigurationsOperations.get_by_name` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` - Method `SoftwareUpdateConfigurationsOperations.list` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` - - Deleted or renamed model `AutomationClientOperationsMixin` - - Deleted or renamed model `DscCompilationJobOperations` - - Deleted or renamed model `DscCompilationJobStreamOperations` - Method `DscConfigurationOperations.get_content` changed return type from `AsyncIterator[bytes]` to `str` - Method `RunbookDraftOperations.begin_replace_content` changed return type from `AsyncLROPoller[AsyncIterator[bytes]]` to `AsyncLROPoller[None]` - Method `RunbookDraftOperations.get_content` changed return type from `AsyncIterator[bytes]` to `str` @@ -289,6 +138,10 @@ - Method `RunbookDraftOperations.get_content` changed return type from `Iterator[bytes]` to `str` - Method `RunbookOperations.get_content` changed return type from `Iterator[bytes]` to `str` +### Other Changes + + - Deleted model `JobListResultV2`/`SourceControlSyncJobStreamsListBySyncJob` which actually were not used by SDK users + ## 1.0.1 (2026-05-14) ### Other Changes From 19b3ee1a56403b193329470fc0ca046e32682e95 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 28 May 2026 10:53:50 +0800 Subject: [PATCH 3/4] fix ci --- .../azure-mgmt-automation/CHANGELOG.md | 9 +--- .../dev_requirements.txt | 1 - .../tests/test_cli_mgmt_automation_test.py | 51 ------------------- 3 files changed, 2 insertions(+), 59 deletions(-) delete mode 100644 sdk/automation/azure-mgmt-automation/tests/test_cli_mgmt_automation_test.py diff --git a/sdk/automation/azure-mgmt-automation/CHANGELOG.md b/sdk/automation/azure-mgmt-automation/CHANGELOG.md index 16fe0861add0..98dde1bcbdfc 100644 --- a/sdk/automation/azure-mgmt-automation/CHANGELOG.md +++ b/sdk/automation/azure-mgmt-automation/CHANGELOG.md @@ -64,8 +64,6 @@ ### Breaking Changes - This version introduces new hybrid models which have dual dictionary and model nature. Please follow https://aka.ms/azsdk/python/migrate/hybrid-models for migration. - - Deleted or renamed client operation group `AutomationClient.dsc_compilation_job` - - Deleted or renamed client operation group `AutomationClient.dsc_compilation_job_stream` - Model `AgentRegistration` renamed its instance variable `keys` to `keys_property` - Model `AutomationAccountCreateOrUpdateParameters` moved instance variable `sku`, `encryption`, `public_network_access` and `disable_local_auth` under property `properties` whose type is `AutomationAccountCreateOrUpdateProperties` - Model `AutomationAccountUpdateParameters` moved instance variable `sku`, `encryption`, `public_network_access` and `disable_local_auth` under property `properties` whose type is `AutomationAccountUpdateProperties` @@ -103,10 +101,7 @@ - Model `WatcherUpdateParameters` moved instance variable `execution_frequency_in_seconds` under property `properties` whose type is `WatcherUpdateProperties` - Model `WebhookCreateOrUpdateParameters` moved instance variable `is_enabled`, `uri`, `expiry_time`, `parameters`, `runbook` and `run_on` under property `properties` whose type is `WebhookCreateOrUpdateProperties` - Model `WebhookUpdateParameters` moved instance variable `is_enabled`, `run_on`, `parameters` and `description` under property `properties` whose type is `WebhookUpdateProperties` - - Deleted or renamed model `DscCompilationJob` - - Deleted or renamed model `DscCompilationJobCreateParameters` - - Deleted or renamed model `RunbookCreateOrUpdateDraftParameters` - - Deleted or renamed model `RunbookCreateOrUpdateDraftProperties` + - Deleted operation group `AutomationClient.dsc_compilation_job`/`AutomationClient.dsc_compilation_job_stream` and their corresponding models `DscCompilationJob`/`DscCompilationJobCreateParameters` were also deleted - Method `DscConfigurationOperations.list_by_automation_account` changed its parameter `inlinecount` from `positional_or_keyword` to `keyword_only` - Method `DscNodeConfigurationOperations.list_by_automation_account` changed its parameter `inlinecount` from `positional_or_keyword` to `keyword_only` - Method `DscNodeOperations.list_by_automation_account` changed its parameter `inlinecount` from `positional_or_keyword` to `keyword_only` @@ -140,7 +135,7 @@ ### Other Changes - - Deleted model `JobListResultV2`/`SourceControlSyncJobStreamsListBySyncJob` which actually were not used by SDK users + - Deleted model `JobListResultV2`/`SourceControlSyncJobStreamsListBySyncJob`/`RunbookCreateOrUpdateDraftParameters`/`RunbookCreateOrUpdateDraftProperties` which actually were not used by SDK users ## 1.0.1 (2026-05-14) diff --git a/sdk/automation/azure-mgmt-automation/dev_requirements.txt b/sdk/automation/azure-mgmt-automation/dev_requirements.txt index a8e71c5456b3..21cc05c69feb 100644 --- a/sdk/automation/azure-mgmt-automation/dev_requirements.txt +++ b/sdk/automation/azure-mgmt-automation/dev_requirements.txt @@ -1,4 +1,3 @@ -e ../../../eng/tools/azure-sdk-tools ../../identity/azure-identity -azure-mgmt-resource<=21.1.0 aiohttp \ No newline at end of file diff --git a/sdk/automation/azure-mgmt-automation/tests/test_cli_mgmt_automation_test.py b/sdk/automation/azure-mgmt-automation/tests/test_cli_mgmt_automation_test.py deleted file mode 100644 index 3c520940bae4..000000000000 --- a/sdk/automation/azure-mgmt-automation/tests/test_cli_mgmt_automation_test.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. -# -------------------------------------------------------------------------- - - -# TEST SCENARIO COVERAGE -# ---------------------- -# Methods Total : 147 -# Methods Covered : 146 -# Examples Total : 167 -# Examples Tested : 166 -# Coverage % : 98.72499898162857 -# ---------------------- - -# current coverage: 85 - -import time -import unittest -import pytest -import azure.mgmt.automation -from devtools_testutils import AzureMgmtRecordedTestCase, ResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.live_test_only -class TestMgmtAutomationClient(AzureMgmtRecordedTestCase): - - def setup_method(self, method): - self.mgmt_client = self.create_mgmt_client(azure.mgmt.automation.AutomationClient) - - @ResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_automation(self, resource_group): - - AUTOMATION_ACCOUNT_NAME = "myAutomationAccount9" - - # Create or update automation account[put] - BODY = {"sku": {"name": "Free"}, "name": AUTOMATION_ACCOUNT_NAME, "location": "East US 2"} - self.mgmt_client.automation_account.create_or_update(resource_group.name, AUTOMATION_ACCOUNT_NAME, BODY) - - # List software update configuration machine runs for a specific software update configuration run[get] - self.mgmt_client.software_update_configuration_machine_runs.list(resource_group.name, AUTOMATION_ACCOUNT_NAME) - - -if __name__ == "__main__": - unittest.main() From 24f2e8e729533ab614680643eca2706357899575 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 28 May 2026 10:57:28 +0800 Subject: [PATCH 4/4] update changelog --- sdk/automation/azure-mgmt-automation/CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sdk/automation/azure-mgmt-automation/CHANGELOG.md b/sdk/automation/azure-mgmt-automation/CHANGELOG.md index 98dde1bcbdfc..c0bf30082361 100644 --- a/sdk/automation/azure-mgmt-automation/CHANGELOG.md +++ b/sdk/automation/azure-mgmt-automation/CHANGELOG.md @@ -64,6 +64,7 @@ ### Breaking Changes - This version introduces new hybrid models which have dual dictionary and model nature. Please follow https://aka.ms/azsdk/python/migrate/hybrid-models for migration. + - For the method breakings, please refer to https://aka.ms/azsdk/python/migrate/operations for migration. - Model `AgentRegistration` renamed its instance variable `keys` to `keys_property` - Model `AutomationAccountCreateOrUpdateParameters` moved instance variable `sku`, `encryption`, `public_network_access` and `disable_local_auth` under property `properties` whose type is `AutomationAccountCreateOrUpdateProperties` - Model `AutomationAccountUpdateParameters` moved instance variable `sku`, `encryption`, `public_network_access` and `disable_local_auth` under property `properties` whose type is `AutomationAccountUpdateProperties` @@ -123,10 +124,6 @@ - Method `SoftwareUpdateConfigurationsOperations.delete` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` - Method `SoftwareUpdateConfigurationsOperations.get_by_name` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` - Method `SoftwareUpdateConfigurationsOperations.list` changed its parameter `client_request_id` from `positional_or_keyword` to `keyword_only` - - Method `DscConfigurationOperations.get_content` changed return type from `AsyncIterator[bytes]` to `str` - - Method `RunbookDraftOperations.begin_replace_content` changed return type from `AsyncLROPoller[AsyncIterator[bytes]]` to `AsyncLROPoller[None]` - - Method `RunbookDraftOperations.get_content` changed return type from `AsyncIterator[bytes]` to `str` - - Method `RunbookOperations.get_content` changed return type from `AsyncIterator[bytes]` to `str` - Method `DscConfigurationOperations.get_content` changed return type from `Iterator[bytes]` to `str` - Method `NodeReportsOperations.get_content` changed return type from `JSON` to `str` - Method `RunbookDraftOperations.begin_replace_content` changed return type from `LROPoller[Iterator[bytes]]` to `LROPoller[None]`