From 94b4c0312b9bf42c032a476382119beac8ee6585 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 7 Nov 2022 09:35:39 +0000 Subject: [PATCH] CodeGen from PR 21267 in Azure/azure-rest-api-specs release-securityinsights-Microsoft.SecurityInsights-2022-11-01-preview (#21267) * Adds base for updating Microsoft.SecurityInsights from version preview/2022-10-01-preview to version 2022-11-01-preview * Updates readme * Updates API version in new specs and examples * added recommendations specs (#21118) * model validation fixes (#21350) Co-authored-by: Vaspate <103540155+Vaspate@users.noreply.github.com> Co-authored-by: dosegal <51155368+dosegal@users.noreply.github.com> --- .../azure-mgmt-securityinsight/_meta.json | 12 +- .../azure/mgmt/securityinsight/__init__.py | 4 +- .../mgmt/securityinsight/_configuration.py | 10 +- .../securityinsight/_security_insights.py | 17 +- .../azure/mgmt/securityinsight/_version.py | 2 +- .../mgmt/securityinsight/aio/__init__.py | 4 +- .../securityinsight/aio/_configuration.py | 10 +- .../securityinsight/aio/_security_insights.py | 17 +- .../aio/operations/__init__.py | 6 + .../aio/operations/_actions_operations.py | 36 +- .../_alert_rule_templates_operations.py | 28 +- .../aio/operations/_alert_rules_operations.py | 36 +- .../_automation_rules_operations.py | 35 +- .../aio/operations/_bookmark_operations.py | 9 +- .../_bookmark_relations_operations.py | 36 +- .../aio/operations/_bookmarks_operations.py | 36 +- ...onnectors_check_requirements_operations.py | 9 +- .../operations/_data_connectors_operations.py | 44 +- .../operations/_domain_whois_operations.py | 9 +- .../_entities_get_timeline_operations.py | 9 +- .../aio/operations/_entities_operations.py | 42 +- .../_entities_relations_operations.py | 24 +- .../operations/_entity_queries_operations.py | 38 +- .../_entity_query_templates_operations.py | 30 +- .../_entity_relations_operations.py | 9 +- .../operations/_file_imports_operations.py | 40 +- .../aio/operations/_get_operations.py | 122 ++++ .../_get_recommendations_operations.py | 117 ++++ .../_incident_comments_operations.py | 36 +- .../_incident_relations_operations.py | 36 +- .../aio/operations/_incidents_operations.py | 55 +- .../aio/operations/_ip_geodata_operations.py | 9 +- .../aio/operations/_metadata_operations.py | 40 +- .../operations/_office_consents_operations.py | 32 +- .../aio/operations/_operations.py | 24 +- .../_product_settings_operations.py | 21 +- ...curity_ml_analytics_settings_operations.py | 36 +- .../_sentinel_onboarding_states_operations.py | 21 +- .../operations/_source_control_operations.py | 26 +- .../operations/_source_controls_operations.py | 36 +- ...telligence_indicator_metrics_operations.py | 9 +- ...hreat_intelligence_indicator_operations.py | 48 +- ...reat_intelligence_indicators_operations.py | 24 +- .../aio/operations/_update_operations.py | 290 ++++++++++ .../operations/_watchlist_items_operations.py | 36 +- .../aio/operations/_watchlists_operations.py | 36 +- .../mgmt/securityinsight/models/__init__.py | 26 + .../securityinsight/models/_models_py3.py | 535 +++++++++++++++++- .../models/_security_insights_enums.py | 79 ++- .../securityinsight/operations/__init__.py | 6 + .../operations/_actions_operations.py | 52 +- .../_alert_rule_templates_operations.py | 36 +- .../operations/_alert_rules_operations.py | 52 +- .../_automation_rules_operations.py | 51 +- .../operations/_bookmark_operations.py | 13 +- .../_bookmark_relations_operations.py | 52 +- .../operations/_bookmarks_operations.py | 52 +- ...onnectors_check_requirements_operations.py | 13 +- .../operations/_data_connectors_operations.py | 68 ++- .../operations/_domain_whois_operations.py | 13 +- .../_entities_get_timeline_operations.py | 13 +- .../operations/_entities_operations.py | 64 ++- .../_entities_relations_operations.py | 28 +- .../operations/_entity_queries_operations.py | 56 +- .../_entity_query_templates_operations.py | 40 +- .../_entity_relations_operations.py | 13 +- .../operations/_file_imports_operations.py | 56 +- .../operations/_get_operations.py | 161 ++++++ .../_get_recommendations_operations.py | 155 +++++ .../_incident_comments_operations.py | 52 +- .../_incident_relations_operations.py | 52 +- .../operations/_incidents_operations.py | 91 ++- .../operations/_ip_geodata_operations.py | 13 +- .../operations/_metadata_operations.py | 60 +- .../operations/_office_consents_operations.py | 44 +- .../securityinsight/operations/_operations.py | 28 +- .../_product_settings_operations.py | 37 +- ...curity_ml_analytics_settings_operations.py | 52 +- .../_sentinel_onboarding_states_operations.py | 37 +- .../operations/_source_control_operations.py | 32 +- .../operations/_source_controls_operations.py | 52 +- ...telligence_indicator_metrics_operations.py | 13 +- ...hreat_intelligence_indicator_operations.py | 76 ++- ...reat_intelligence_indicators_operations.py | 28 +- .../operations/_update_operations.py | 332 +++++++++++ .../operations/_watchlist_items_operations.py | 52 +- .../operations/_watchlists_operations.py | 52 +- .../automation_rules_create_or_update.py | 42 ++ .../automation_rules_delete.py | 42 ++ .../generated_samples/automation_rules_get.py | 42 ++ .../automation_rules_list.py | 42 ++ .../connect_an_api_polling_data_connector.py | 54 ++ ...t_an_api_polling_v2_logs_data_connector.py | 57 ++ .../create/update_full_metadata..py | 95 ++++ .../create/update_minimal_metadata..py | 49 ++ .../create_a_file_import..py | 50 ++ .../create_sentinel_onboarding_state.py | 42 ++ .../creates_a_recommendation..py | 43 ++ .../creates_a_source_control..py | 60 ++ .../creates_incident_teams_group..py | 43 ++ ...or_updates_a_api_polling_data_connector.py | 126 +++++ .../creates_or_updates_a_bookmark..py | 64 +++ ...creates_or_updates_a_bookmark_relation..py | 48 ++ ...r_updates_a_dynamics365_data_connector..py | 50 ++ ...creates_or_updates_a_fusion_alert_rule..py | 179 ++++++ ...t_rule_with_scenario_exclusion_pattern..py | 179 ++++++ ..._or_updates_a_generic_ui_data_connector.py | 161 ++++++ ...rosoft_security_incident_creation_rule..py | 51 ++ .../creates_or_updates_a_nrt_alert_rule..py | 68 +++ ...ates_or_updates_a_scheduled_alert_rule..py | 89 +++ ...reat_intelligence_taxii_data_connector..py | 58 ++ .../creates_or_updates_a_watchlist..py | 53 ++ ...hlist_and_bulk_creates_watchlist_items..py | 56 ++ .../creates_or_updates_a_watchlist_item..py | 56 ++ ...tes_or_updates_an_action_of_alert_rule..py | 50 ++ ...es_or_updates_an_activity_entity_query..py | 64 +++ .../creates_or_updates_an_incident..py | 57 ++ ...creates_or_updates_an_incident_comment..py | 44 ++ ...reates_or_updates_an_incident_relation..py | 48 ++ ..._or_updates_an_office365_data_connector.py | 54 ++ ...tes_an_office365_project_data_connector.py | 50 ++ ...dates_an_office_power_bi_data_connector.py | 50 ++ ...at_intelligence_platform_data_connector.py | 50 ++ .../delete_a_api_polling_data_connector.py | 42 ++ .../generated_samples/delete_a_bookmark..py | 42 ++ .../delete_a_file_import..py | 42 ++ .../delete_a_generic_ui_data_connector.py | 42 ++ ...elete_a_security_ml_analytics_settings..py | 42 ++ .../delete_a_source_control..py | 42 ++ .../delete_a_threat_intelligence_indicator.py | 42 ++ .../generated_samples/delete_a_watchlist..py | 42 ++ .../delete_a_watchlist_item..py | 43 ++ .../delete_an_action_of_alert_rule..py | 43 ++ .../delete_an_alert_rule..py | 42 ++ .../delete_an_entity_query..py | 42 ++ .../generated_samples/delete_an_incident..py | 42 ++ .../delete_an_office365_data_connector.py | 42 ++ ...ete_an_office365_project_data_connector.py | 42 ++ .../delete_an_office_consent..py | 42 ++ ...elete_an_office_power_bi_data_connector.py | 42 ++ .../delete_eyes_on_settings..py | 42 ++ .../generated_samples/delete_metadata..py | 42 ++ .../delete_sentinel_onboarding_state.py | 42 ++ .../delete_the_bookmark_relation..py | 43 ++ .../delete_the_incident_comment..py | 43 ++ .../delete_the_incident_relation..py | 43 ++ ...isconnect_an_api_polling_data_connector.py | 42 ++ .../generated_samples/entity_insight.py | 48 ++ .../generated_samples/entity_timeline.py | 47 ++ .../generated_samples/expand_an_bookmark.py | 47 ++ .../generated_samples/expand_an_entity.py | 47 ++ ...anomaly_security_ml_analytics_settings..py | 42 ++ .../get_a_api_polling_data_connector.py | 42 ++ .../get_a_asc_data_connector.py | 42 ++ .../generated_samples/get_a_bookmark..py | 42 ++ .../get_a_bookmark_relation..py | 43 ++ .../get_a_cloud_application_entity..py | 42 ++ .../generated_samples/get_a_dns_entity..py | 42 ++ .../get_a_dynamics365_data_connector.py | 42 ++ .../generated_samples/get_a_file_entity..py | 42 ++ .../get_a_file_hash_entity..py | 42 ++ .../generated_samples/get_a_file_import..py | 42 ++ .../get_a_fusion_alert_rule..py | 42 ++ .../get_a_generic_ui_data_connector.py | 42 ++ .../generated_samples/get_a_host_entity..py | 42 ++ .../get_a_io_t_data_connector.py | 42 ++ .../get_a_mail_cluster_entity..py | 42 ++ .../get_a_mail_message_entity..py | 42 ++ .../get_a_mailbox_entity..py | 42 ++ .../get_a_malware_entity..py | 42 ++ .../get_a_mcas_data_connector.py | 42 ++ .../get_a_mdatp_data_connector.py | 42 ++ ...rosoft_security_incident_creation_rule..py | 42 ++ ...soft_threat_intelligence_data_connector.py | 42 ++ ...rosoft_threat_protection_data_connector.py | 42 ++ .../get_a_process_entity..py | 42 ++ .../get_a_recommendation..py | 42 ++ .../get_a_registry_key_entity..py | 42 ++ .../get_a_registry_value_entity..py | 42 ++ .../get_a_scheduled_alert_rule..py | 42 ++ .../get_a_security_alert_entity..py | 42 ++ .../get_a_security_group_entity..py | 42 ++ .../get_a_source_control..py | 42 ++ .../get_a_submission_mail_entity..py | 42 ++ .../get_a_ti_data_connector.py | 42 ++ .../get_a_ti_taxii_data_connector..py | 42 ++ .../generated_samples/get_a_url_entity..py | 42 ++ .../generated_samples/get_a_watchlist..py | 42 ++ .../get_a_watchlist_item..py | 43 ++ .../get_alert_rule_template_by_id..py | 42 ++ .../get_all_actions_of_alert_rule..py | 43 ++ .../get_all_alert_rule_templates..py | 42 ++ .../generated_samples/get_all_alert_rules..py | 42 ++ .../get_all_bookmark_relations..py | 43 ++ .../generated_samples/get_all_bookmarks..py | 42 ++ .../get_all_data_connectors..py | 42 ++ .../generated_samples/get_all_entities..py | 42 ++ .../get_all_entity_queries..py | 42 ++ .../get_all_entity_query_templates..py | 42 ++ .../get_all_file_imports..py | 42 ++ .../get_all_incident_alerts..py | 42 ++ .../get_all_incident_bookmarks..py | 42 ++ .../get_all_incident_comments..py | 43 ++ .../get_all_incident_relations..py | 43 ++ .../generated_samples/get_all_incidents..py | 42 ++ .../generated_samples/get_all_metadata..py | 42 ++ .../orderby/skip/top.py | 42 ++ .../get_all_office_consents..py | 42 ++ .../generated_samples/get_all_operations..py | 39 ++ .../get_all_relations_of_an_entity..py | 43 ++ ...get_all_security_ml_analytics_settings..py | 42 ++ .../get_all_sentinel_onboarding_states.py | 41 ++ .../generated_samples/get_all_settings..py | 41 ++ .../get_all_source_controls..py | 42 ++ .../get_all_threat_intelligence_indicators.py | 42 ++ .../get_all_watchlist_items..py | 43 ++ .../generated_samples/get_all_watchlists..py | 42 ++ .../get_an_aad_data_connector.py | 42 ++ .../get_an_aatp_data_connector.py | 42 ++ .../get_an_account_entity..py | 42 ++ .../get_an_action_of_alert_rule..py | 43 ++ .../get_an_activity_entity_query..py | 42 ++ .../get_an_activity_entity_query_template..py | 42 ++ .../get_an_aws_cloud_trail_data_connector.py | 42 ++ .../get_an_aws_s3_data_connector.py | 42 ++ .../get_an_azure_resource_entity..py | 42 ++ .../get_an_entity_relation..py | 43 ++ .../get_an_expansion_entity_query..py | 42 ++ .../generated_samples/get_an_incident..py | 42 ++ .../get_an_incident_comment..py | 43 ++ .../get_an_incident_relation..py | 43 ++ .../get_an_io_t_device_entity..py | 42 ++ .../generated_samples/get_an_ip_entity..py | 42 ++ .../get_an_nrt_alert_rule..py | 42 ++ .../get_an_office365_data_connector..py | 42 ++ ...et_an_office365_power_bi_data_connector.py | 42 ++ ...get_an_office365_project_data_connector.py | 42 ++ .../get_an_office_atp_data_connector.py | 42 ++ .../get_an_office_consent..py | 42 ++ .../get_an_office_irm_data_connector.py | 42 ++ .../generated_samples/get_entity_query.py | 43 ++ .../get_eyes_on_settings..py | 42 ++ .../get_geodata_for_a_single_ip_address.py | 41 ++ .../get_recommendations_list..py | 41 ++ .../generated_samples/get_repository_list..py | 43 ++ .../get_sentinel_onboarding_state.py | 42 ++ .../get_single_metadata_by_name.py | 42 ++ ...threat_intelligence_indicators_metrics..py | 41 ++ ...is_information_for_a_single_domain_name.py | 41 ++ .../gets_all_incident_related_entities.py | 42 ++ .../incidents_run_playbook.py | 42 ++ .../update_eyes_on_settings..py | 43 ++ .../generated_samples/update_metadata..py | 43 ++ ...a_threat_intelligence_indicator_by_name.py | 42 ++ 254 files changed, 11677 insertions(+), 567 deletions(-) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_recommendations_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_update_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_recommendations_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_update_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_create_or_update.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_delete.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_get.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_list.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_an_api_polling_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_an_api_polling_v2_logs_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create/update_full_metadata..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create/update_minimal_metadata..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_a_file_import..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_sentinel_onboarding_state.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_a_recommendation..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_a_source_control..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_incident_teams_group..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_api_polling_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_bookmark..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_bookmark_relation..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_dynamics365_data_connector..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_fusion_alert_rule..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_fusion_alert_rule_with_scenario_exclusion_pattern..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_generic_ui_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_microsoft_security_incident_creation_rule..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_nrt_alert_rule..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_scheduled_alert_rule..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_threat_intelligence_taxii_data_connector..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_watchlist..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_watchlist_and_bulk_creates_watchlist_items..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_watchlist_item..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_action_of_alert_rule..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_activity_entity_query..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_incident..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_incident_comment..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_incident_relation..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_office365_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_office365_project_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_office_power_bi_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_threat_intelligence_platform_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_api_polling_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_bookmark..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_file_import..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_generic_ui_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_security_ml_analytics_settings..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_source_control..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_threat_intelligence_indicator.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_watchlist..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_watchlist_item..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_action_of_alert_rule..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_alert_rule..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_entity_query..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_incident..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office365_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office365_project_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office_consent..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office_power_bi_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_eyes_on_settings..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_metadata..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_sentinel_onboarding_state.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_the_bookmark_relation..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_the_incident_comment..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_the_incident_relation..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/disconnect_an_api_polling_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_insight.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_timeline.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/expand_an_bookmark.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/expand_an_entity.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_anomaly_security_ml_analytics_settings..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_api_polling_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_asc_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_bookmark..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_bookmark_relation..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_cloud_application_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_dns_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_dynamics365_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_file_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_file_hash_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_file_import..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_fusion_alert_rule..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_generic_ui_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_host_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_io_t_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mail_cluster_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mail_message_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mailbox_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_malware_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mcas_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mdatp_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_microsoft_security_incident_creation_rule..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_microsoft_threat_intelligence_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_microsoft_threat_protection_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_process_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_recommendation..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_registry_key_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_registry_value_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_scheduled_alert_rule..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_security_alert_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_security_group_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_source_control..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_submission_mail_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_ti_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_ti_taxii_data_connector..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_url_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_watchlist..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_watchlist_item..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_alert_rule_template_by_id..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_actions_of_alert_rule..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_alert_rule_templates..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_alert_rules..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_bookmark_relations..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_bookmarks..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_data_connectors..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entities..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entity_queries..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entity_query_templates..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_file_imports..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_alerts..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_bookmarks..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_comments..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_relations..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incidents..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata_with_odata_filter/orderby/skip/top.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_office_consents..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_operations..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_relations_of_an_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_security_ml_analytics_settings..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_sentinel_onboarding_states.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_settings..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_source_controls..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_threat_intelligence_indicators.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_watchlist_items..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_watchlists..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aad_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aatp_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_account_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_action_of_alert_rule..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_activity_entity_query..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_activity_entity_query_template..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aws_cloud_trail_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aws_s3_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_azure_resource_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_entity_relation..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_expansion_entity_query..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_incident..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_incident_comment..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_incident_relation..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_io_t_device_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_ip_entity..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_nrt_alert_rule..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office365_data_connector..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office365_power_bi_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office365_project_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office_atp_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office_consent..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office_irm_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entity_query.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_eyes_on_settings..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_geodata_for_a_single_ip_address.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_recommendations_list..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_repository_list..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_sentinel_onboarding_state.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_single_metadata_by_name.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_threat_intelligence_indicators_metrics..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_whois_information_for_a_single_domain_name.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/gets_all_incident_related_entities.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_run_playbook.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/update_eyes_on_settings..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/update_metadata..py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/view_a_threat_intelligence_indicator_by_name.py diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json b/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json index 99147466e4e94..a013ab584fda1 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json +++ b/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.8.4", + "commit": "b20e4034615cfed39916e77538229254c9b1b701", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.2", "use": [ - "@autorest/python@6.1.6", - "@autorest/modelerfour@4.23.5" + "@autorest/python@6.2.1", + "@autorest/modelerfour@4.24.3" ], - "commit": "e24bbf6a66cb0a19c072c6f15cee163acbd7acf7", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/securityinsights/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.1.6 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False", + "autorest_command": "autorest specification/securityinsights/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/securityinsights/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/__init__.py index e4e61752e108b..83c612fe81d7d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityInsights"] +__all__ = [ + "SecurityInsights", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py index ecbee99313d02..ebe481bf8e043 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -29,14 +35,14 @@ class SecurityInsightsConfiguration(Configuration): # pylint: disable=too-many- :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityInsightsConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-09-01-preview") # type: str + api_version = kwargs.pop("api_version", "2022-11-01-preview") # type: Literal["2022-11-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_security_insights.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_security_insights.py index c5301c13be5bf..5826e523a3faa 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_security_insights.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_security_insights.py @@ -33,6 +33,8 @@ EntityQueryTemplatesOperations, EntityRelationsOperations, FileImportsOperations, + GetOperations, + GetRecommendationsOperations, IPGeodataOperations, IncidentCommentsOperations, IncidentRelationsOperations, @@ -48,6 +50,7 @@ ThreatIntelligenceIndicatorMetricsOperations, ThreatIntelligenceIndicatorOperations, ThreatIntelligenceIndicatorsOperations, + UpdateOperations, WatchlistItemsOperations, WatchlistsOperations, ) @@ -117,6 +120,13 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to :vartype source_control: azure.mgmt.securityinsight.operations.SourceControlOperations :ivar source_controls: SourceControlsOperations operations :vartype source_controls: azure.mgmt.securityinsight.operations.SourceControlsOperations + :ivar get_recommendations: GetRecommendationsOperations operations + :vartype get_recommendations: + azure.mgmt.securityinsight.operations.GetRecommendationsOperations + :ivar get: GetOperations operations + :vartype get: azure.mgmt.securityinsight.operations.GetOperations + :ivar update: UpdateOperations operations + :vartype update: azure.mgmt.securityinsight.operations.UpdateOperations :ivar threat_intelligence_indicator: ThreatIntelligenceIndicatorOperations operations :vartype threat_intelligence_indicator: azure.mgmt.securityinsight.operations.ThreatIntelligenceIndicatorOperations @@ -144,7 +154,7 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -215,6 +225,11 @@ def __init__( ) self.source_control = SourceControlOperations(self._client, self._config, self._serialize, self._deserialize) self.source_controls = SourceControlsOperations(self._client, self._config, self._serialize, self._deserialize) + self.get_recommendations = GetRecommendationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.get = GetOperations(self._client, self._config, self._serialize, self._deserialize) + self.update = UpdateOperations(self._client, self._config, self._serialize, self._deserialize) self.threat_intelligence_indicator = ThreatIntelligenceIndicatorOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_version.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_version.py index e32dc6ec42180..e5754a47ce68f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_version.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/__init__.py index 6c57b1fcf3b2e..c43d6f528dd6f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityInsights"] +__all__ = [ + "SecurityInsights", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py index 661bb8ba8f158..cd3262c947335 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -29,14 +35,14 @@ class SecurityInsightsConfiguration(Configuration): # pylint: disable=too-many- :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityInsightsConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-09-01-preview") # type: str + api_version = kwargs.pop("api_version", "2022-11-01-preview") # type: Literal["2022-11-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_security_insights.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_security_insights.py index bb8132adc57e0..dfe33401db4fc 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_security_insights.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_security_insights.py @@ -33,6 +33,8 @@ EntityQueryTemplatesOperations, EntityRelationsOperations, FileImportsOperations, + GetOperations, + GetRecommendationsOperations, IPGeodataOperations, IncidentCommentsOperations, IncidentRelationsOperations, @@ -48,6 +50,7 @@ ThreatIntelligenceIndicatorMetricsOperations, ThreatIntelligenceIndicatorOperations, ThreatIntelligenceIndicatorsOperations, + UpdateOperations, WatchlistItemsOperations, WatchlistsOperations, ) @@ -121,6 +124,13 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to :vartype source_control: azure.mgmt.securityinsight.aio.operations.SourceControlOperations :ivar source_controls: SourceControlsOperations operations :vartype source_controls: azure.mgmt.securityinsight.aio.operations.SourceControlsOperations + :ivar get_recommendations: GetRecommendationsOperations operations + :vartype get_recommendations: + azure.mgmt.securityinsight.aio.operations.GetRecommendationsOperations + :ivar get: GetOperations operations + :vartype get: azure.mgmt.securityinsight.aio.operations.GetOperations + :ivar update: UpdateOperations operations + :vartype update: azure.mgmt.securityinsight.aio.operations.UpdateOperations :ivar threat_intelligence_indicator: ThreatIntelligenceIndicatorOperations operations :vartype threat_intelligence_indicator: azure.mgmt.securityinsight.aio.operations.ThreatIntelligenceIndicatorOperations @@ -148,7 +158,7 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -219,6 +229,11 @@ def __init__( ) self.source_control = SourceControlOperations(self._client, self._config, self._serialize, self._deserialize) self.source_controls = SourceControlsOperations(self._client, self._config, self._serialize, self._deserialize) + self.get_recommendations = GetRecommendationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.get = GetOperations(self._client, self._config, self._serialize, self._deserialize) + self.update = UpdateOperations(self._client, self._config, self._serialize, self._deserialize) self.threat_intelligence_indicator = ThreatIntelligenceIndicatorOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/__init__.py index 918cd7e781bc8..383b3752d7717 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/__init__.py @@ -32,6 +32,9 @@ from ._product_settings_operations import ProductSettingsOperations from ._source_control_operations import SourceControlOperations from ._source_controls_operations import SourceControlsOperations +from ._get_recommendations_operations import GetRecommendationsOperations +from ._get_operations import GetOperations +from ._update_operations import UpdateOperations from ._threat_intelligence_indicator_operations import ThreatIntelligenceIndicatorOperations from ._threat_intelligence_indicators_operations import ThreatIntelligenceIndicatorsOperations from ._threat_intelligence_indicator_metrics_operations import ThreatIntelligenceIndicatorMetricsOperations @@ -72,6 +75,9 @@ "ProductSettingsOperations", "SourceControlOperations", "SourceControlsOperations", + "GetRecommendationsOperations", + "GetOperations", + "UpdateOperations", "ThreatIntelligenceIndicatorOperations", "ThreatIntelligenceIndicatorsOperations", "ThreatIntelligenceIndicatorMetricsOperations", diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_actions_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_actions_operations.py index e2ba8ed8b3b6c..8216f5af95567 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_actions_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_actions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_by_alert_rule_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +85,9 @@ def list_by_alert_rule( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ActionsList] error_map = { @@ -109,10 +116,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -174,7 +188,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ActionResponse] request = build_get_request( @@ -320,7 +336,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.ActionResponse] @@ -403,7 +421,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_templates_operations.py index ae7cbee98f9c6..55fb7b62fa683 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_templates_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_templates_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._alert_rule_templates_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +78,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertRuleTemplatesList] error_map = { @@ -101,10 +108,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -164,7 +178,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertRuleTemplate] request = build_get_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py index e90209db8fa90..de06b2204a970 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +80,9 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertRulesList] error_map = { @@ -103,10 +110,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -166,7 +180,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertRule] request = build_get_request( @@ -302,7 +318,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertRule] @@ -382,7 +400,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_automation_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_automation_rules_operations.py index 05318351f9dc8..a8c02e71dc30e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_automation_rules_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_automation_rules_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -40,6 +40,10 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,7 +97,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationRule] request = build_get_request( @@ -230,7 +236,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationRule] @@ -313,7 +321,9 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[JSON] request = build_delete_request( @@ -372,7 +382,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationRulesList] error_map = { @@ -400,10 +412,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_operations.py index 0bc2f11256526..38da75962d349 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._bookmark_operations import build_expand_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -154,7 +159,9 @@ async def expand( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.BookmarkExpandResponse] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_relations_operations.py index 5eda0064a5f0e..148c59b2c3e6f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_relations_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RelationList] error_map = { @@ -132,10 +139,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -197,7 +211,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Relation] request = build_get_request( @@ -343,7 +359,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Relation] @@ -426,7 +444,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmarks_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmarks_operations.py index 131710ee60cc3..1a3614a34460e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmarks_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmarks_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +80,9 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.BookmarkList] error_map = { @@ -103,10 +110,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -166,7 +180,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Bookmark] request = build_get_request( @@ -302,7 +318,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Bookmark] @@ -382,7 +400,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_check_requirements_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_check_requirements_operations.py index 1125c97459d2f..48ccca86332fe 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_check_requirements_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_check_requirements_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._data_connectors_check_requirements_operations import build_post_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -147,7 +152,9 @@ async def post( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.DataConnectorRequirementsState] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py index 74d7d4ac5c138..290573994bd71 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,6 +38,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +85,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.DataConnectorList] error_map = { @@ -108,10 +115,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -171,7 +185,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.DataConnector] request = build_get_request( @@ -307,7 +323,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.DataConnector] @@ -387,7 +405,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -519,7 +539,9 @@ async def connect( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] @@ -591,7 +613,9 @@ async def disconnect( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_disconnect_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_domain_whois_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_domain_whois_operations.py index 207cd14212b4d..d9270b89f7a1b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_domain_whois_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_domain_whois_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._domain_whois_operations import build_get_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +80,9 @@ async def get(self, resource_group_name: str, domain: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EnrichmentDomainWhois] request = build_get_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_get_timeline_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_get_timeline_operations.py index 6bd6134938014..a7ea83421af12 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_get_timeline_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_get_timeline_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._entities_get_timeline_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -154,7 +159,9 @@ async def list( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityTimelineResponse] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_operations.py index 8b09f270231a4..b7195f6840847 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_queries_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +81,9 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityList] error_map = { @@ -104,10 +111,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -165,7 +179,9 @@ async def get(self, resource_group_name: str, workspace_name: str, entity_id: st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Entity] request = build_get_request( @@ -304,7 +320,9 @@ async def expand( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityExpandResponse] @@ -357,7 +375,7 @@ async def queries( resource_group_name: str, workspace_name: str, entity_id: str, - kind: Union[str, "_models.EntityItemQueryKind"], + kind: Union[str, _models.EntityItemQueryKind], **kwargs: Any ) -> _models.GetQueriesResponse: """Get Insights and Activities for an entity. @@ -387,7 +405,9 @@ async def queries( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GetQueriesResponse] request = build_queries_request( @@ -525,7 +545,9 @@ async def get_insights( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityGetInsightsResponse] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_relations_operations.py index 0635f3ca4b7b4..68c910cf15d70 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_relations_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._entities_relations_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,7 +98,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RelationList] error_map = { @@ -126,10 +133,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_queries_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_queries_operations.py index d65f2fd3ab331..9039225a5dfc6 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_queries_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_queries_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ def list( self, resource_group_name: str, workspace_name: str, - kind: Optional[Union[str, "_models.Enum13"]] = None, + kind: Optional[Union[str, _models.Enum13]] = None, **kwargs: Any ) -> AsyncIterable["_models.EntityQuery"]: """Gets all entity queries. @@ -84,7 +89,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityQueryList] error_map = { @@ -113,10 +120,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -176,7 +190,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityQuery] request = build_get_request( @@ -313,7 +329,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityQuery] @@ -393,7 +411,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_query_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_query_templates_operations.py index 1b80597a38b3b..4edb0d88e7403 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_query_templates_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_query_templates_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._entity_query_templates_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ def list( self, resource_group_name: str, workspace_name: str, - kind: Optional[Union[str, "_models.Enum15"]] = None, + kind: Optional[Union[str, _models.Enum15]] = None, **kwargs: Any ) -> AsyncIterable["_models.EntityQueryTemplate"]: """Gets all entity query templates. @@ -79,7 +84,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityQueryTemplateList] error_map = { @@ -108,10 +115,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -171,7 +185,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityQueryTemplate] request = build_get_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_relations_operations.py index f4649e0d2dadf..b3e1a46bac684 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_relations_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._entity_relations_operations import build_get_relation_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,9 @@ async def get_relation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Relation] request = build_get_relation_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_file_imports_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_file_imports_operations.py index 9803ac6a5893c..1cc77ef0d9d1b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_file_imports_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_file_imports_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,6 +38,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -98,7 +103,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.FileImportList] error_map = { @@ -130,10 +137,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -193,7 +207,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.FileImport] request = build_get_request( @@ -329,7 +345,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.FileImport] @@ -390,7 +408,9 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.FileImport]] request = build_delete_request( @@ -456,7 +476,9 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.FileImport] polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_operations.py new file mode 100644 index 0000000000000..5f2ed4b6bb120 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_operations.py @@ -0,0 +1,122 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._get_operations import build_single_recommendation_request + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GetOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`get` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def single_recommendation( + self, resource_group_name: str, workspace_name: str, recommendation_id: str, **kwargs: Any + ) -> _models.Recommendation: + """Gets a recommendation by its id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param recommendation_id: Recommendation Id. Required. + :type recommendation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Recommendation or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Recommendation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Recommendation] + + request = build_single_recommendation_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + recommendation_id=recommendation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.single_recommendation.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Recommendation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + single_recommendation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations/{recommendationId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_recommendations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_recommendations_operations.py new file mode 100644 index 0000000000000..53615d1936de2 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_recommendations_operations.py @@ -0,0 +1,117 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._get_recommendations_operations import build_list_request + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GetRecommendationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`get_recommendations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.RecommendationList: + """Gets a list of all recommendations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecommendationList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.RecommendationList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecommendationList] + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RecommendationList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py index 25b0f7a6d90bf..b5ebd6172f65e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -100,7 +105,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentCommentList] error_map = { @@ -133,10 +140,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,7 +212,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentComment] request = build_get_request( @@ -344,7 +360,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentComment] @@ -427,7 +445,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_relations_operations.py index 9d63d815a7636..6170c85402e18 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_relations_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RelationList] error_map = { @@ -132,10 +139,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -197,7 +211,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Relation] request = build_get_request( @@ -343,7 +359,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Relation] @@ -426,7 +444,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py index c6e5a274da306..608708f105a86 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -45,6 +45,10 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -170,7 +174,9 @@ async def run_playbook( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[JSON] @@ -258,7 +264,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentList] error_map = { @@ -290,10 +298,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -353,7 +368,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Incident] request = build_get_request( @@ -489,7 +506,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Incident] @@ -569,7 +588,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -704,7 +725,9 @@ async def create_team( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.TeamInformation] @@ -780,7 +803,9 @@ async def list_alerts( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentAlertList] request = build_list_alerts_request( @@ -844,7 +869,9 @@ async def list_bookmarks( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentBookmarkList] request = build_list_bookmarks_request( @@ -908,7 +935,9 @@ async def list_entities( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentEntitiesResponse] request = build_list_entities_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_ip_geodata_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_ip_geodata_operations.py index 4e4505491d8be..b0b04f9db2048 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_ip_geodata_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_ip_geodata_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._ip_geodata_operations import build_get_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +80,9 @@ async def get(self, resource_group_name: str, ip_address: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EnrichmentIpGeodata] request = build_get_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_metadata_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_metadata_operations.py index a87d16e7d2357..4a906391f007a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_metadata_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_metadata_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -96,7 +101,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataList] error_map = { @@ -128,10 +135,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -191,7 +205,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataModel] request = build_get_request( @@ -255,7 +271,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -387,7 +405,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataModel] @@ -539,7 +559,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataModel] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_office_consents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_office_consents_operations.py index 68b5df51365cd..1b0d6ff0dfc99 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_office_consents_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_office_consents_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._office_consents_operations import build_delete_request, build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +78,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.OfficeConsentList] error_map = { @@ -101,10 +108,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -164,7 +178,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.OfficeConsent] request = build_get_request( @@ -228,7 +244,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py index 853a36291e363..92d227f7bc7d0 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationsList] error_map = { @@ -89,10 +96,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_settings_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_settings_operations.py index b50f0b0ae2f89..75b503e8cafc4 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_settings_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_settings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -32,6 +33,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +85,9 @@ async def list(self, resource_group_name: str, workspace_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingList] request = build_list_request( @@ -144,7 +151,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Settings] request = build_get_request( @@ -209,7 +218,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -344,7 +355,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Settings] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_security_ml_analytics_settings_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_security_ml_analytics_settings_operations.py index 84a4820d31a1b..c9e4d6bcb7c8f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_security_ml_analytics_settings_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_security_ml_analytics_settings_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +84,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityMLAnalyticsSettingsList] error_map = { @@ -107,10 +114,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -170,7 +184,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityMLAnalyticsSetting] request = build_get_request( @@ -309,7 +325,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityMLAnalyticsSetting] @@ -389,7 +407,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_sentinel_onboarding_states_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_sentinel_onboarding_states_operations.py index 99b1548abc91e..c049b6e30ba68 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_sentinel_onboarding_states_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_sentinel_onboarding_states_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -32,6 +33,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SentinelOnboardingState] request = build_get_request( @@ -229,7 +236,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SentinelOnboardingState] @@ -313,7 +322,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -371,7 +382,9 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SentinelOnboardingStatesList] request = build_list_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_control_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_control_operations.py index 5031d60ab1195..ee958efdbf910 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_control_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_control_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._source_control_operations import build_list_repositories_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +59,7 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list_repositories( - self, resource_group_name: str, workspace_name: str, repo_type: Union[str, "_models.RepoType"], **kwargs: Any + self, resource_group_name: str, workspace_name: str, repo_type: Union[str, _models.RepoType], **kwargs: Any ) -> AsyncIterable["_models.Repo"]: """Gets a list of repositories metadata. @@ -73,7 +78,9 @@ def list_repositories( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str cls = kwargs.pop("cls", None) # type: ClsType[_models.RepoList] @@ -105,10 +112,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_controls_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_controls_operations.py index c0bf26db58786..d0d06989aed49 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_controls_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_controls_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +83,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SourceControlList] error_map = { @@ -106,10 +113,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -169,7 +183,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SourceControl] request = build_get_request( @@ -233,7 +249,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -365,7 +383,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SourceControl] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_metrics_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_metrics_operations.py index fced1306e9e7a..54a0a5eefb1c1 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_metrics_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_metrics_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._threat_intelligence_indicator_metrics_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +82,9 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceMetricsList] request = build_list_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_operations.py index 989b8e02a25b7..eeebacdad602e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -38,6 +39,10 @@ build_replace_tags_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -158,7 +163,9 @@ async def create_indicator( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceInformation] @@ -237,7 +244,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceInformation] request = build_get_request( @@ -378,7 +387,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceInformation] @@ -458,7 +469,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -584,7 +597,9 @@ def query_indicators( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceInformationList] @@ -623,10 +638,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -763,7 +785,9 @@ async def append_tags( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] @@ -912,7 +936,9 @@ async def replace_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceInformation] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicators_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicators_operations.py index 96f5b118a7487..93747ce784179 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicators_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicators_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._threat_intelligence_indicators_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +97,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceInformationList] error_map = { @@ -124,10 +131,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_update_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_update_operations.py new file mode 100644 index 0000000000000..988a02336186a --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_update_operations.py @@ -0,0 +1,290 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._update_operations import build_recommendation_request + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class UpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`update` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _recommendation_initial( + self, + resource_group_name: str, + workspace_name: str, + recommendation_id: str, + recommendation_patch: Union[List[_models.RecommendationPatch], IO], + **kwargs: Any + ) -> _models.Recommendation: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Recommendation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(recommendation_patch, (IO, bytes)): + _content = recommendation_patch + else: + _json = self._serialize.body(recommendation_patch, "[RecommendationPatch]") + + request = build_recommendation_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + recommendation_id=recommendation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._recommendation_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Recommendation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _recommendation_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations/{recommendationId}"} # type: ignore + + @overload + async def begin_recommendation( + self, + resource_group_name: str, + workspace_name: str, + recommendation_id: str, + recommendation_patch: List[_models.RecommendationPatch], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Recommendation]: + """Patch a recommendation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param recommendation_id: Recommendation Id. Required. + :type recommendation_id: str + :param recommendation_patch: Recommendation Fields to Update. Required. + :type recommendation_patch: list[~azure.mgmt.securityinsight.models.RecommendationPatch] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Recommendation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.securityinsight.models.Recommendation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_recommendation( + self, + resource_group_name: str, + workspace_name: str, + recommendation_id: str, + recommendation_patch: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Recommendation]: + """Patch a recommendation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param recommendation_id: Recommendation Id. Required. + :type recommendation_id: str + :param recommendation_patch: Recommendation Fields to Update. Required. + :type recommendation_patch: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Recommendation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.securityinsight.models.Recommendation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_recommendation( + self, + resource_group_name: str, + workspace_name: str, + recommendation_id: str, + recommendation_patch: Union[List[_models.RecommendationPatch], IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Recommendation]: + """Patch a recommendation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param recommendation_id: Recommendation Id. Required. + :type recommendation_id: str + :param recommendation_patch: Recommendation Fields to Update. Is either a list type or a IO + type. Required. + :type recommendation_patch: list[~azure.mgmt.securityinsight.models.RecommendationPatch] or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Recommendation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.securityinsight.models.Recommendation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Recommendation] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._recommendation_initial( # type: ignore + resource_group_name=resource_group_name, + workspace_name=workspace_name, + recommendation_id=recommendation_id, + recommendation_patch=recommendation_patch, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Recommendation", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_recommendation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations/{recommendationId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlist_items_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlist_items_operations.py index 754a540fe93c2..a147a3affb32c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlist_items_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlist_items_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +95,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.WatchlistItemList] error_map = { @@ -120,10 +127,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -185,7 +199,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.WatchlistItem] request = build_get_request( @@ -252,7 +268,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -394,7 +412,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.WatchlistItem] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlists_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlists_operations.py index 300146db41482..3fd477d1b7df8 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlists_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlists_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +87,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.WatchlistList] error_map = { @@ -111,10 +118,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -174,7 +188,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Watchlist] request = build_get_request( @@ -238,7 +254,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -391,7 +409,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Watchlist] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/__init__.py index a16c2475d0648..37944ef111eb0 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/__init__.py @@ -32,6 +32,7 @@ from ._models_py3 import ActivityEntityQueryTemplatePropertiesQueryDefinitions from ._models_py3 import ActivityTimelineItem from ._models_py3 import AlertDetailsOverride +from ._models_py3 import AlertPropertyMapping from ._models_py3 import AlertRule from ._models_py3 import AlertRuleTemplate from ._models_py3 import AlertRuleTemplateDataSource @@ -95,6 +96,7 @@ from ._models_py3 import ConnectedEntity from ._models_py3 import ConnectivityCriteria from ._models_py3 import ConnectorInstructionModelBase +from ._models_py3 import Content from ._models_py3 import ContentPathMap from ._models_py3 import CustomEntityQuery from ._models_py3 import Customs @@ -209,6 +211,7 @@ from ._models_py3 import InsightsTableResultColumnsItem from ._models_py3 import InstructionSteps from ._models_py3 import InstructionStepsInstructionsItem +from ._models_py3 import Instructions from ._models_py3 import IoTCheckRequirements from ._models_py3 import IoTDataConnector from ._models_py3 import IoTDataConnectorProperties @@ -311,6 +314,10 @@ from ._models_py3 import PropertyChangedConditionProperties from ._models_py3 import PropertyConditionProperties from ._models_py3 import QueryBasedAlertRuleTemplateProperties +from ._models_py3 import Recommendation +from ._models_py3 import RecommendationList +from ._models_py3 import RecommendationPatch +from ._models_py3 import RecommendedAction from ._models_py3 import RegistryKeyEntity from ._models_py3 import RegistryKeyEntityProperties from ._models_py3 import RegistryValueEntity @@ -339,6 +346,7 @@ from ._models_py3 import SecurityMLAnalyticsSetting from ._models_py3 import SecurityMLAnalyticsSettingsDataSource from ._models_py3 import SecurityMLAnalyticsSettingsList +from ._models_py3 import SentinelEntityMapping from ._models_py3 import SentinelOnboardingState from ._models_py3 import SentinelOnboardingStatesList from ._models_py3 import SettingList @@ -398,6 +406,7 @@ from ._security_insights_enums import ActionType from ._security_insights_enums import AlertDetail +from ._security_insights_enums import AlertProperty from ._security_insights_enums import AlertRuleKind from ._security_insights_enums import AlertSeverity from ._security_insights_enums import AlertStatus @@ -412,12 +421,14 @@ from ._security_insights_enums import AutomationRulePropertyChangedConditionSupportedPropertyType from ._security_insights_enums import AutomationRulePropertyConditionSupportedOperator from ._security_insights_enums import AutomationRulePropertyConditionSupportedProperty +from ._security_insights_enums import Category from ._security_insights_enums import ConditionType from ._security_insights_enums import ConfidenceLevel from ._security_insights_enums import ConfidenceScoreStatus from ._security_insights_enums import ConnectAuthKind from ._security_insights_enums import ConnectivityType from ._security_insights_enums import ContentType +from ._security_insights_enums import Context from ._security_insights_enums import CreatedByType from ._security_insights_enums import CustomEntityQueryKind from ._security_insights_enums import DataConnectorAuthorizationState @@ -464,6 +475,7 @@ from ._security_insights_enums import OwnerType from ._security_insights_enums import PermissionProviderScope from ._security_insights_enums import PollingFrequency +from ._security_insights_enums import Priority from ._security_insights_enums import ProviderName from ._security_insights_enums import RegistryHive from ._security_insights_enums import RegistryValueKind @@ -474,6 +486,7 @@ from ._security_insights_enums import SettingsStatus from ._security_insights_enums import SourceKind from ._security_insights_enums import SourceType +from ._security_insights_enums import State from ._security_insights_enums import SupportTier from ._security_insights_enums import TemplateStatus from ._security_insights_enums import ThreatIntelligenceResourceKindEnum @@ -514,6 +527,7 @@ "ActivityEntityQueryTemplatePropertiesQueryDefinitions", "ActivityTimelineItem", "AlertDetailsOverride", + "AlertPropertyMapping", "AlertRule", "AlertRuleTemplate", "AlertRuleTemplateDataSource", @@ -577,6 +591,7 @@ "ConnectedEntity", "ConnectivityCriteria", "ConnectorInstructionModelBase", + "Content", "ContentPathMap", "CustomEntityQuery", "Customs", @@ -691,6 +706,7 @@ "InsightsTableResultColumnsItem", "InstructionSteps", "InstructionStepsInstructionsItem", + "Instructions", "IoTCheckRequirements", "IoTDataConnector", "IoTDataConnectorProperties", @@ -793,6 +809,10 @@ "PropertyChangedConditionProperties", "PropertyConditionProperties", "QueryBasedAlertRuleTemplateProperties", + "Recommendation", + "RecommendationList", + "RecommendationPatch", + "RecommendedAction", "RegistryKeyEntity", "RegistryKeyEntityProperties", "RegistryValueEntity", @@ -821,6 +841,7 @@ "SecurityMLAnalyticsSetting", "SecurityMLAnalyticsSettingsDataSource", "SecurityMLAnalyticsSettingsList", + "SentinelEntityMapping", "SentinelOnboardingState", "SentinelOnboardingStatesList", "SettingList", @@ -879,6 +900,7 @@ "Webhook", "ActionType", "AlertDetail", + "AlertProperty", "AlertRuleKind", "AlertSeverity", "AlertStatus", @@ -893,12 +915,14 @@ "AutomationRulePropertyChangedConditionSupportedPropertyType", "AutomationRulePropertyConditionSupportedOperator", "AutomationRulePropertyConditionSupportedProperty", + "Category", "ConditionType", "ConfidenceLevel", "ConfidenceScoreStatus", "ConnectAuthKind", "ConnectivityType", "ContentType", + "Context", "CreatedByType", "CustomEntityQueryKind", "DataConnectorAuthorizationState", @@ -945,6 +969,7 @@ "OwnerType", "PermissionProviderScope", "PollingFrequency", + "Priority", "ProviderName", "RegistryHive", "RegistryValueKind", @@ -955,6 +980,7 @@ "SettingsStatus", "SourceKind", "SourceType", + "State", "SupportTier", "TemplateStatus", "ThreatIntelligenceResourceKindEnum", diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models_py3.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models_py3.py index d8a58ef47d7ad..8d35b54e2cfc9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models_py3.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models_py3.py @@ -13,13 +13,18 @@ from .. import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -1982,6 +1987,9 @@ class AlertDetailsOverride(_serialization.Model): :vartype alert_tactics_column_name: str :ivar alert_severity_column_name: the column name to take the alert severity from. :vartype alert_severity_column_name: str + :ivar alert_dynamic_properties: List of additional dynamic properties to override. + :vartype alert_dynamic_properties: + list[~azure.mgmt.securityinsight.models.AlertPropertyMapping] """ _attribute_map = { @@ -1989,6 +1997,7 @@ class AlertDetailsOverride(_serialization.Model): "alert_description_format": {"key": "alertDescriptionFormat", "type": "str"}, "alert_tactics_column_name": {"key": "alertTacticsColumnName", "type": "str"}, "alert_severity_column_name": {"key": "alertSeverityColumnName", "type": "str"}, + "alert_dynamic_properties": {"key": "alertDynamicProperties", "type": "[AlertPropertyMapping]"}, } def __init__( @@ -1998,6 +2007,7 @@ def __init__( alert_description_format: Optional[str] = None, alert_tactics_column_name: Optional[str] = None, alert_severity_column_name: Optional[str] = None, + alert_dynamic_properties: Optional[List["_models.AlertPropertyMapping"]] = None, **kwargs ): """ @@ -2011,12 +2021,52 @@ def __init__( :paramtype alert_tactics_column_name: str :keyword alert_severity_column_name: the column name to take the alert severity from. :paramtype alert_severity_column_name: str + :keyword alert_dynamic_properties: List of additional dynamic properties to override. + :paramtype alert_dynamic_properties: + list[~azure.mgmt.securityinsight.models.AlertPropertyMapping] """ super().__init__(**kwargs) self.alert_display_name_format = alert_display_name_format self.alert_description_format = alert_description_format self.alert_tactics_column_name = alert_tactics_column_name self.alert_severity_column_name = alert_severity_column_name + self.alert_dynamic_properties = alert_dynamic_properties + + +class AlertPropertyMapping(_serialization.Model): + """A single alert property mapping to override. + + :ivar alert_property: The V3 alert property. Known values are: "AlertLink", "ConfidenceLevel", + "ConfidenceScore", "ExtendedLinks", "ProductName", "ProviderName", "ProductComponentName", + "RemediationSteps", and "Techniques". + :vartype alert_property: str or ~azure.mgmt.securityinsight.models.AlertProperty + :ivar value: the column name to use to override this property. + :vartype value: str + """ + + _attribute_map = { + "alert_property": {"key": "alertProperty", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__( + self, + *, + alert_property: Optional[Union[str, "_models.AlertProperty"]] = None, + value: Optional[str] = None, + **kwargs + ): + """ + :keyword alert_property: The V3 alert property. Known values are: "AlertLink", + "ConfidenceLevel", "ConfidenceScore", "ExtendedLinks", "ProductName", "ProviderName", + "ProductComponentName", "RemediationSteps", and "Techniques". + :paramtype alert_property: str or ~azure.mgmt.securityinsight.models.AlertProperty + :keyword value: the column name to use to override this property. + :paramtype value: str + """ + super().__init__(**kwargs) + self.alert_property = alert_property + self.value = value class AlertRule(ResourceWithEtag): @@ -3644,7 +3694,7 @@ class Availability(_serialization.Model): "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__(self, *, status: Optional[int] = None, is_preview: Optional[bool] = None, **kwargs): + def __init__(self, *, status: Optional[Literal[1]] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword status: The connector Availability Status. Default value is 1. :paramtype status: int @@ -5922,6 +5972,39 @@ def __init__(self, *, type: Union[str, "_models.SettingType"], parameters: Optio self.type = type +class Content(_serialization.Model): + """Content section of the recommendation. + + All required parameters must be populated in order to send to Azure. + + :ivar title: Title of the content. Required. + :vartype title: str + :ivar description: Description of the content. Required. + :vartype description: str + """ + + _validation = { + "title": {"required": True}, + "description": {"required": True}, + } + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, *, title: str, description: str, **kwargs): + """ + :keyword title: Title of the content. Required. + :paramtype title: str + :keyword description: Description of the content. Required. + :paramtype description: str + """ + super().__init__(**kwargs) + self.title = title + self.description = description + + class ContentPathMap(_serialization.Model): """The mapping of content type to a repo path. @@ -11125,6 +11208,54 @@ def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, ** self.name = name +class Instructions(_serialization.Model): + """Instructions section of a recommendation. + + All required parameters must be populated in order to send to Azure. + + :ivar actions_to_be_performed: What actions should be taken to complete the recommendation. + Required. + :vartype actions_to_be_performed: str + :ivar recommendation_importance: Explains why the recommendation is important. Required. + :vartype recommendation_importance: str + :ivar how_to_perform_action_details: How should the user complete the recommendation. + :vartype how_to_perform_action_details: str + """ + + _validation = { + "actions_to_be_performed": {"required": True}, + "recommendation_importance": {"required": True}, + } + + _attribute_map = { + "actions_to_be_performed": {"key": "actionsToBePerformed", "type": "str"}, + "recommendation_importance": {"key": "recommendationImportance", "type": "str"}, + "how_to_perform_action_details": {"key": "howToPerformActionDetails", "type": "str"}, + } + + def __init__( + self, + *, + actions_to_be_performed: str, + recommendation_importance: str, + how_to_perform_action_details: Optional[str] = None, + **kwargs + ): + """ + :keyword actions_to_be_performed: What actions should be taken to complete the recommendation. + Required. + :paramtype actions_to_be_performed: str + :keyword recommendation_importance: Explains why the recommendation is important. Required. + :paramtype recommendation_importance: str + :keyword how_to_perform_action_details: How should the user complete the recommendation. + :paramtype how_to_perform_action_details: str + """ + super().__init__(**kwargs) + self.actions_to_be_performed = actions_to_be_performed + self.recommendation_importance = recommendation_importance + self.how_to_perform_action_details = how_to_perform_action_details + + class InstructionStepsInstructionsItem(ConnectorInstructionModelBase): """InstructionStepsInstructionsItem. @@ -15367,6 +15498,9 @@ class NrtAlertRule(AlertRule): # pylint: disable=too-many-instance-attributes :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride :ivar event_grouping_settings: The event grouping settings. :vartype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :vartype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ _validation = { @@ -15402,9 +15536,10 @@ class NrtAlertRule(AlertRule): # pylint: disable=too-many-instance-attributes "entity_mappings": {"key": "properties.entityMappings", "type": "[EntityMapping]"}, "alert_details_override": {"key": "properties.alertDetailsOverride", "type": "AlertDetailsOverride"}, "event_grouping_settings": {"key": "properties.eventGroupingSettings", "type": "EventGroupingSettings"}, + "sentinel_entities_mappings": {"key": "properties.sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, etag: Optional[str] = None, @@ -15424,6 +15559,7 @@ def __init__( entity_mappings: Optional[List["_models.EntityMapping"]] = None, alert_details_override: Optional["_models.AlertDetailsOverride"] = None, event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, + sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, **kwargs ): """ @@ -15468,6 +15604,9 @@ def __init__( :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride :keyword event_grouping_settings: The event grouping settings. :paramtype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :paramtype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ super().__init__(etag=etag, **kwargs) self.kind = "NRT" # type: str @@ -15488,6 +15627,7 @@ def __init__( self.entity_mappings = entity_mappings self.alert_details_override = alert_details_override self.event_grouping_settings = event_grouping_settings + self.sentinel_entities_mappings = sentinel_entities_mappings class NrtAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-instance-attributes @@ -15550,6 +15690,9 @@ class NrtAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-insta :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride :ivar event_grouping_settings: The event grouping settings. :vartype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :vartype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ _validation = { @@ -15587,6 +15730,7 @@ class NrtAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-insta "entity_mappings": {"key": "properties.entityMappings", "type": "[EntityMapping]"}, "alert_details_override": {"key": "properties.alertDetailsOverride", "type": "AlertDetailsOverride"}, "event_grouping_settings": {"key": "properties.eventGroupingSettings", "type": "EventGroupingSettings"}, + "sentinel_entities_mappings": {"key": "properties.sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, } def __init__( @@ -15606,6 +15750,7 @@ def __init__( entity_mappings: Optional[List["_models.EntityMapping"]] = None, alert_details_override: Optional["_models.AlertDetailsOverride"] = None, event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, + sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, **kwargs ): """ @@ -15643,6 +15788,9 @@ def __init__( :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride :keyword event_grouping_settings: The event grouping settings. :paramtype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :paramtype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ super().__init__(**kwargs) self.kind = "NRT" # type: str @@ -15662,6 +15810,7 @@ def __init__( self.entity_mappings = entity_mappings self.alert_details_override = alert_details_override self.event_grouping_settings = event_grouping_settings + self.sentinel_entities_mappings = sentinel_entities_mappings class QueryBasedAlertRuleTemplateProperties(_serialization.Model): @@ -15684,6 +15833,9 @@ class QueryBasedAlertRuleTemplateProperties(_serialization.Model): :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride :ivar event_grouping_settings: The event grouping settings. :vartype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :vartype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ _attribute_map = { @@ -15694,6 +15846,7 @@ class QueryBasedAlertRuleTemplateProperties(_serialization.Model): "entity_mappings": {"key": "entityMappings", "type": "[EntityMapping]"}, "alert_details_override": {"key": "alertDetailsOverride", "type": "AlertDetailsOverride"}, "event_grouping_settings": {"key": "eventGroupingSettings", "type": "EventGroupingSettings"}, + "sentinel_entities_mappings": {"key": "sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, } def __init__( @@ -15706,6 +15859,7 @@ def __init__( entity_mappings: Optional[List["_models.EntityMapping"]] = None, alert_details_override: Optional["_models.AlertDetailsOverride"] = None, event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, + sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, **kwargs ): """ @@ -15726,6 +15880,9 @@ def __init__( :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride :keyword event_grouping_settings: The event grouping settings. :paramtype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :paramtype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ super().__init__(**kwargs) self.query = query @@ -15735,6 +15892,7 @@ def __init__( self.entity_mappings = entity_mappings self.alert_details_override = alert_details_override self.event_grouping_settings = event_grouping_settings + self.sentinel_entities_mappings = sentinel_entities_mappings class NrtAlertRuleTemplateProperties( @@ -15761,6 +15919,9 @@ class NrtAlertRuleTemplateProperties( :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride :ivar event_grouping_settings: The event grouping settings. :vartype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :vartype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] :ivar alert_rules_created_by_template_count: the number of alert rules that were created by this template. :vartype alert_rules_created_by_template_count: int @@ -15797,6 +15958,7 @@ class NrtAlertRuleTemplateProperties( "entity_mappings": {"key": "entityMappings", "type": "[EntityMapping]"}, "alert_details_override": {"key": "alertDetailsOverride", "type": "AlertDetailsOverride"}, "event_grouping_settings": {"key": "eventGroupingSettings", "type": "EventGroupingSettings"}, + "sentinel_entities_mappings": {"key": "sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, "alert_rules_created_by_template_count": {"key": "alertRulesCreatedByTemplateCount", "type": "int"}, "last_updated_date_utc": {"key": "lastUpdatedDateUTC", "type": "iso-8601"}, "created_date_utc": {"key": "createdDateUTC", "type": "iso-8601"}, @@ -15818,6 +15980,7 @@ def __init__( entity_mappings: Optional[List["_models.EntityMapping"]] = None, alert_details_override: Optional["_models.AlertDetailsOverride"] = None, event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, + sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, alert_rules_created_by_template_count: Optional[int] = None, description: Optional[str] = None, display_name: Optional[str] = None, @@ -15845,6 +16008,9 @@ def __init__( :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride :keyword event_grouping_settings: The event grouping settings. :paramtype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :paramtype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] :keyword alert_rules_created_by_template_count: the number of alert rules that were created by this template. :paramtype alert_rules_created_by_template_count: int @@ -15878,6 +16044,7 @@ def __init__( entity_mappings=entity_mappings, alert_details_override=alert_details_override, event_grouping_settings=event_grouping_settings, + sentinel_entities_mappings=sentinel_entities_mappings, **kwargs ) self.query = query @@ -15887,6 +16054,7 @@ def __init__( self.entity_mappings = entity_mappings self.alert_details_override = alert_details_override self.event_grouping_settings = event_grouping_settings + self.sentinel_entities_mappings = sentinel_entities_mappings self.alert_rules_created_by_template_count = alert_rules_created_by_template_count self.last_updated_date_utc = None self.created_date_utc = None @@ -17667,6 +17835,286 @@ def __init__( self.condition_properties = condition_properties +class Recommendation(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Recommendation object. + + All required parameters must be populated in order to send to Azure. + + :ivar id: id of recommendation. Required. + :vartype id: str + :ivar instructions: Instructions of the recommendation. Required. + :vartype instructions: ~azure.mgmt.securityinsight.models.Instructions + :ivar content: Content of the recommendation. + :vartype content: ~azure.mgmt.securityinsight.models.Content + :ivar resource_id: Id of the resource this recommendation refers to. + :vartype resource_id: str + :ivar additional_properties: Collection of additional properties for the recommendation. + :vartype additional_properties: dict[str, str] + :ivar title: Title of the recommendation. Required. + :vartype title: str + :ivar description: Description of the recommendation. Required. + :vartype description: str + :ivar recommendation_type_title: Title of the recommendation type. Required. + :vartype recommendation_type_title: str + :ivar recommendation_type_id: Id of the recommendation type. Required. + :vartype recommendation_type_id: str + :ivar category: Category of the recommendation. Required. Known values are: "Onboarding", + "NewFeature", "SocEfficiency", "CostOptimization", and "Demo". + :vartype category: str or ~azure.mgmt.securityinsight.models.Category + :ivar context: Context of the recommendation. Required. Known values are: "Analytics", + "Incidents", "Overview", and "None". + :vartype context: str or ~azure.mgmt.securityinsight.models.Context + :ivar workspace_id: Id of the workspace this recommendation refers to. Required. + :vartype workspace_id: str + :ivar actions: List of actions to take for this recommendation. Required. + :vartype actions: list[~azure.mgmt.securityinsight.models.RecommendedAction] + :ivar state: State of the recommendation. Required. Known values are: "Active", "Disabled", + "CompletedByUser", "CompletedByAction", and "Hidden". + :vartype state: str or ~azure.mgmt.securityinsight.models.State + :ivar priority: Priority of the recommendation. Required. Known values are: "Low", "Medium", + and "High". + :vartype priority: str or ~azure.mgmt.securityinsight.models.Priority + :ivar last_evaluated_time_utc: The time stamp (UTC) when the recommendation was last evaluated. + Required. + :vartype last_evaluated_time_utc: ~datetime.datetime + :ivar hide_until_time_utc: The time stamp (UTC) when the recommendation should be displayed + again. + :vartype hide_until_time_utc: ~datetime.datetime + :ivar display_until_time_utc: The timestamp (UTC) after which the recommendation should not be + displayed anymore. + :vartype display_until_time_utc: ~datetime.datetime + :ivar visible: Value indicating if the recommendation should be displayed or not. + :vartype visible: bool + """ + + _validation = { + "id": {"required": True}, + "instructions": {"required": True}, + "title": {"required": True}, + "description": {"required": True}, + "recommendation_type_title": {"required": True}, + "recommendation_type_id": {"required": True}, + "category": {"required": True}, + "context": {"required": True}, + "workspace_id": {"required": True}, + "actions": {"required": True}, + "state": {"required": True}, + "priority": {"required": True}, + "last_evaluated_time_utc": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "instructions": {"key": "instructions", "type": "Instructions"}, + "content": {"key": "content", "type": "Content"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "additional_properties": {"key": "additionalProperties", "type": "{str}"}, + "title": {"key": "title", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "recommendation_type_title": {"key": "recommendationTypeTitle", "type": "str"}, + "recommendation_type_id": {"key": "recommendationTypeId", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "workspace_id": {"key": "workspaceId", "type": "str"}, + "actions": {"key": "actions", "type": "[RecommendedAction]"}, + "state": {"key": "state", "type": "str"}, + "priority": {"key": "priority", "type": "str"}, + "last_evaluated_time_utc": {"key": "lastEvaluatedTimeUtc", "type": "iso-8601"}, + "hide_until_time_utc": {"key": "hideUntilTimeUtc", "type": "iso-8601"}, + "display_until_time_utc": {"key": "displayUntilTimeUtc", "type": "iso-8601"}, + "visible": {"key": "visible", "type": "bool"}, + } + + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + instructions: "_models.Instructions", + title: str, + description: str, + recommendation_type_title: str, + recommendation_type_id: str, + category: Union[str, "_models.Category"], + context: Union[str, "_models.Context"], + workspace_id: str, + actions: List["_models.RecommendedAction"], + state: Union[str, "_models.State"], + priority: Union[str, "_models.Priority"], + last_evaluated_time_utc: datetime.datetime, + content: Optional["_models.Content"] = None, + resource_id: Optional[str] = None, + additional_properties: Optional[Dict[str, str]] = None, + hide_until_time_utc: Optional[datetime.datetime] = None, + display_until_time_utc: Optional[datetime.datetime] = None, + visible: Optional[bool] = None, + **kwargs + ): + """ + :keyword id: id of recommendation. Required. + :paramtype id: str + :keyword instructions: Instructions of the recommendation. Required. + :paramtype instructions: ~azure.mgmt.securityinsight.models.Instructions + :keyword content: Content of the recommendation. + :paramtype content: ~azure.mgmt.securityinsight.models.Content + :keyword resource_id: Id of the resource this recommendation refers to. + :paramtype resource_id: str + :keyword additional_properties: Collection of additional properties for the recommendation. + :paramtype additional_properties: dict[str, str] + :keyword title: Title of the recommendation. Required. + :paramtype title: str + :keyword description: Description of the recommendation. Required. + :paramtype description: str + :keyword recommendation_type_title: Title of the recommendation type. Required. + :paramtype recommendation_type_title: str + :keyword recommendation_type_id: Id of the recommendation type. Required. + :paramtype recommendation_type_id: str + :keyword category: Category of the recommendation. Required. Known values are: "Onboarding", + "NewFeature", "SocEfficiency", "CostOptimization", and "Demo". + :paramtype category: str or ~azure.mgmt.securityinsight.models.Category + :keyword context: Context of the recommendation. Required. Known values are: "Analytics", + "Incidents", "Overview", and "None". + :paramtype context: str or ~azure.mgmt.securityinsight.models.Context + :keyword workspace_id: Id of the workspace this recommendation refers to. Required. + :paramtype workspace_id: str + :keyword actions: List of actions to take for this recommendation. Required. + :paramtype actions: list[~azure.mgmt.securityinsight.models.RecommendedAction] + :keyword state: State of the recommendation. Required. Known values are: "Active", "Disabled", + "CompletedByUser", "CompletedByAction", and "Hidden". + :paramtype state: str or ~azure.mgmt.securityinsight.models.State + :keyword priority: Priority of the recommendation. Required. Known values are: "Low", "Medium", + and "High". + :paramtype priority: str or ~azure.mgmt.securityinsight.models.Priority + :keyword last_evaluated_time_utc: The time stamp (UTC) when the recommendation was last + evaluated. Required. + :paramtype last_evaluated_time_utc: ~datetime.datetime + :keyword hide_until_time_utc: The time stamp (UTC) when the recommendation should be displayed + again. + :paramtype hide_until_time_utc: ~datetime.datetime + :keyword display_until_time_utc: The timestamp (UTC) after which the recommendation should not + be displayed anymore. + :paramtype display_until_time_utc: ~datetime.datetime + :keyword visible: Value indicating if the recommendation should be displayed or not. + :paramtype visible: bool + """ + super().__init__(**kwargs) + self.id = id + self.instructions = instructions + self.content = content + self.resource_id = resource_id + self.additional_properties = additional_properties + self.title = title + self.description = description + self.recommendation_type_title = recommendation_type_title + self.recommendation_type_id = recommendation_type_id + self.category = category + self.context = context + self.workspace_id = workspace_id + self.actions = actions + self.state = state + self.priority = priority + self.last_evaluated_time_utc = last_evaluated_time_utc + self.hide_until_time_utc = hide_until_time_utc + self.display_until_time_utc = display_until_time_utc + self.visible = visible + + +class RecommendationList(_serialization.Model): + """A list of recommendations. + + :ivar value: An list of recommendations. + :vartype value: list[~azure.mgmt.securityinsight.models.Recommendation] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Recommendation]"}, + } + + def __init__(self, *, value: Optional[List["_models.Recommendation"]] = None, **kwargs): + """ + :keyword value: An list of recommendations. + :paramtype value: list[~azure.mgmt.securityinsight.models.Recommendation] + """ + super().__init__(**kwargs) + self.value = value + + +class RecommendationPatch(_serialization.Model): + """Recommendation Fields to update. + + :ivar state: State of the recommendation. Known values are: "Active", "Disabled", + "CompletedByUser", "CompletedByAction", and "Hidden". + :vartype state: str or ~azure.mgmt.securityinsight.models.State + :ivar hide_until_time_utc: The time stamp (UTC) when the recommendation should be displayed + again. + :vartype hide_until_time_utc: ~datetime.datetime + """ + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "hide_until_time_utc": {"key": "hideUntilTimeUtc", "type": "iso-8601"}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "_models.State"]] = None, + hide_until_time_utc: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword state: State of the recommendation. Known values are: "Active", "Disabled", + "CompletedByUser", "CompletedByAction", and "Hidden". + :paramtype state: str or ~azure.mgmt.securityinsight.models.State + :keyword hide_until_time_utc: The time stamp (UTC) when the recommendation should be displayed + again. + :paramtype hide_until_time_utc: ~datetime.datetime + """ + super().__init__(**kwargs) + self.state = state + self.hide_until_time_utc = hide_until_time_utc + + +class RecommendedAction(_serialization.Model): + """What actions should be taken to complete the recommendation. + + All required parameters must be populated in order to send to Azure. + + :ivar link_text: Text of the link to complete the action. Required. + :vartype link_text: str + :ivar link_url: The Link to complete the action. Required. + :vartype link_url: str + :ivar state: The state of the action. Known values are: "Low", "Medium", and "High". + :vartype state: str or ~azure.mgmt.securityinsight.models.Priority + """ + + _validation = { + "link_text": {"required": True}, + "link_url": {"required": True}, + } + + _attribute_map = { + "link_text": {"key": "linkText", "type": "str"}, + "link_url": {"key": "linkUrl", "type": "str"}, + "state": {"key": "state", "type": "str"}, + } + + def __init__( + self, *, link_text: str, link_url: str, state: Optional[Union[str, "_models.Priority"]] = None, **kwargs + ): + """ + :keyword link_text: Text of the link to complete the action. Required. + :paramtype link_text: str + :keyword link_url: The Link to complete the action. Required. + :paramtype link_url: str + :keyword state: The state of the action. Known values are: "Low", "Medium", and "High". + :paramtype state: str or ~azure.mgmt.securityinsight.models.Priority + """ + super().__init__(**kwargs) + self.link_text = link_text + self.link_url = link_url + self.state = state + + class RegistryKeyEntity(Entity): """Represents a registry key entity. @@ -18268,6 +18716,9 @@ class ScheduledAlertRule(AlertRule): # pylint: disable=too-many-instance-attrib :vartype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] :ivar alert_details_override: The alert details override settings. :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :vartype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. :vartype alert_rule_template_name: str :ivar template_version: The version of the alert rule template used to create this rule - in @@ -18322,6 +18773,7 @@ class ScheduledAlertRule(AlertRule): # pylint: disable=too-many-instance-attrib "custom_details": {"key": "properties.customDetails", "type": "{str}"}, "entity_mappings": {"key": "properties.entityMappings", "type": "[EntityMapping]"}, "alert_details_override": {"key": "properties.alertDetailsOverride", "type": "AlertDetailsOverride"}, + "sentinel_entities_mappings": {"key": "properties.sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, "alert_rule_template_name": {"key": "properties.alertRuleTemplateName", "type": "str"}, "template_version": {"key": "properties.templateVersion", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, @@ -18349,6 +18801,7 @@ def __init__( # pylint: disable=too-many-locals custom_details: Optional[Dict[str, str]] = None, entity_mappings: Optional[List["_models.EntityMapping"]] = None, alert_details_override: Optional["_models.AlertDetailsOverride"] = None, + sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, alert_rule_template_name: Optional[str] = None, template_version: Optional[str] = None, description: Optional[str] = None, @@ -18388,6 +18841,9 @@ def __init__( # pylint: disable=too-many-locals :paramtype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] :keyword alert_details_override: The alert details override settings. :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :paramtype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] :keyword alert_rule_template_name: The Name of the alert rule template used to create this rule. :paramtype alert_rule_template_name: str @@ -18426,6 +18882,7 @@ def __init__( # pylint: disable=too-many-locals self.custom_details = custom_details self.entity_mappings = entity_mappings self.alert_details_override = alert_details_override + self.sentinel_entities_mappings = sentinel_entities_mappings self.alert_rule_template_name = alert_rule_template_name self.template_version = template_version self.description = description @@ -18439,7 +18896,7 @@ def __init__( # pylint: disable=too-many-locals self.incident_configuration = incident_configuration -class ScheduledAlertRuleCommonProperties(_serialization.Model): +class ScheduledAlertRuleCommonProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Scheduled alert rule template property bag. :ivar query: The query that creates alerts for this rule. @@ -18465,6 +18922,9 @@ class ScheduledAlertRuleCommonProperties(_serialization.Model): :vartype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] :ivar alert_details_override: The alert details override settings. :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :vartype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ _attribute_map = { @@ -18478,6 +18938,7 @@ class ScheduledAlertRuleCommonProperties(_serialization.Model): "custom_details": {"key": "customDetails", "type": "{str}"}, "entity_mappings": {"key": "entityMappings", "type": "[EntityMapping]"}, "alert_details_override": {"key": "alertDetailsOverride", "type": "AlertDetailsOverride"}, + "sentinel_entities_mappings": {"key": "sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, } def __init__( @@ -18493,6 +18954,7 @@ def __init__( custom_details: Optional[Dict[str, str]] = None, entity_mappings: Optional[List["_models.EntityMapping"]] = None, alert_details_override: Optional["_models.AlertDetailsOverride"] = None, + sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, **kwargs ): """ @@ -18520,6 +18982,9 @@ def __init__( :paramtype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] :keyword alert_details_override: The alert details override settings. :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :paramtype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ super().__init__(**kwargs) self.query = query @@ -18532,6 +18997,7 @@ def __init__( self.custom_details = custom_details self.entity_mappings = entity_mappings self.alert_details_override = alert_details_override + self.sentinel_entities_mappings = sentinel_entities_mappings class ScheduledAlertRuleProperties(ScheduledAlertRuleCommonProperties): # pylint: disable=too-many-instance-attributes @@ -18564,6 +19030,9 @@ class ScheduledAlertRuleProperties(ScheduledAlertRuleCommonProperties): # pylin :vartype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] :ivar alert_details_override: The alert details override settings. :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :vartype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. :vartype alert_rule_template_name: str :ivar template_version: The version of the alert rule template used to create this rule - in @@ -18611,6 +19080,7 @@ class ScheduledAlertRuleProperties(ScheduledAlertRuleCommonProperties): # pylin "custom_details": {"key": "customDetails", "type": "{str}"}, "entity_mappings": {"key": "entityMappings", "type": "[EntityMapping]"}, "alert_details_override": {"key": "alertDetailsOverride", "type": "AlertDetailsOverride"}, + "sentinel_entities_mappings": {"key": "sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, "alert_rule_template_name": {"key": "alertRuleTemplateName", "type": "str"}, "template_version": {"key": "templateVersion", "type": "str"}, "description": {"key": "description", "type": "str"}, @@ -18641,6 +19111,7 @@ def __init__( custom_details: Optional[Dict[str, str]] = None, entity_mappings: Optional[List["_models.EntityMapping"]] = None, alert_details_override: Optional["_models.AlertDetailsOverride"] = None, + sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, alert_rule_template_name: Optional[str] = None, template_version: Optional[str] = None, description: Optional[str] = None, @@ -18674,6 +19145,9 @@ def __init__( :paramtype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] :keyword alert_details_override: The alert details override settings. :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :paramtype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] :keyword alert_rule_template_name: The Name of the alert rule template used to create this rule. :paramtype alert_rule_template_name: str @@ -18711,6 +19185,7 @@ def __init__( custom_details=custom_details, entity_mappings=entity_mappings, alert_details_override=alert_details_override, + sentinel_entities_mappings=sentinel_entities_mappings, **kwargs ) self.alert_rule_template_name = alert_rule_template_name @@ -18795,6 +19270,9 @@ class ScheduledAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many :vartype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] :ivar alert_details_override: The alert details override settings. :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :vartype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ _validation = { @@ -18836,6 +19314,7 @@ class ScheduledAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many "custom_details": {"key": "properties.customDetails", "type": "{str}"}, "entity_mappings": {"key": "properties.entityMappings", "type": "[EntityMapping]"}, "alert_details_override": {"key": "properties.alertDetailsOverride", "type": "AlertDetailsOverride"}, + "sentinel_entities_mappings": {"key": "properties.sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, } def __init__( # pylint: disable=too-many-locals @@ -18859,6 +19338,7 @@ def __init__( # pylint: disable=too-many-locals custom_details: Optional[Dict[str, str]] = None, entity_mappings: Optional[List["_models.EntityMapping"]] = None, alert_details_override: Optional["_models.AlertDetailsOverride"] = None, + sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, **kwargs ): """ @@ -18906,6 +19386,9 @@ def __init__( # pylint: disable=too-many-locals :paramtype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] :keyword alert_details_override: The alert details override settings. :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :paramtype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ super().__init__(**kwargs) self.kind = "Scheduled" # type: str @@ -18929,6 +19412,7 @@ def __init__( # pylint: disable=too-many-locals self.custom_details = custom_details self.entity_mappings = entity_mappings self.alert_details_override = alert_details_override + self.sentinel_entities_mappings = sentinel_entities_mappings class SecurityAlert(Entity): # pylint: disable=too-many-instance-attributes @@ -19337,9 +19821,11 @@ def __init__(self, **kwargs): self.reason_type = None -class SecurityAlertTimelineItem(EntityTimelineItem): +class SecurityAlertTimelineItem(EntityTimelineItem): # pylint: disable=too-many-instance-attributes """Represents security alert timeline item. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. :ivar kind: The entity query kind type. Required. Known values are: "Activity", "Bookmark", @@ -19364,6 +19850,13 @@ class SecurityAlertTimelineItem(EntityTimelineItem): :vartype time_generated: ~datetime.datetime :ivar alert_type: The name of the alert type. Required. :vartype alert_type: str + :ivar intent: The intent of the alert. Known values are: "Unknown", "Probing", "Exploitation", + "Persistence", "PrivilegeEscalation", "DefenseEvasion", "CredentialAccess", "Discovery", + "LateralMovement", "Execution", "Collection", "Exfiltration", "CommandAndControl", and + "Impact". + :vartype intent: str or ~azure.mgmt.securityinsight.models.KillChainIntent + :ivar techniques: The techniques of the alert. + :vartype techniques: list[str] """ _validation = { @@ -19375,6 +19868,7 @@ class SecurityAlertTimelineItem(EntityTimelineItem): "start_time_utc": {"required": True}, "time_generated": {"required": True}, "alert_type": {"required": True}, + "intent": {"readonly": True}, } _attribute_map = { @@ -19388,6 +19882,8 @@ class SecurityAlertTimelineItem(EntityTimelineItem): "start_time_utc": {"key": "startTimeUtc", "type": "iso-8601"}, "time_generated": {"key": "timeGenerated", "type": "iso-8601"}, "alert_type": {"key": "alertType", "type": "str"}, + "intent": {"key": "intent", "type": "str"}, + "techniques": {"key": "techniques", "type": "[str]"}, } def __init__( @@ -19402,6 +19898,7 @@ def __init__( alert_type: str, product_name: Optional[str] = None, description: Optional[str] = None, + techniques: Optional[List[str]] = None, **kwargs ): """ @@ -19424,6 +19921,8 @@ def __init__( :paramtype time_generated: ~datetime.datetime :keyword alert_type: The name of the alert type. Required. :paramtype alert_type: str + :keyword techniques: The techniques of the alert. + :paramtype techniques: list[str] """ super().__init__(**kwargs) self.kind = "SecurityAlert" # type: str @@ -19436,6 +19935,8 @@ def __init__( self.start_time_utc = start_time_utc self.time_generated = time_generated self.alert_type = alert_type + self.intent = None + self.techniques = techniques class SecurityGroupEntity(Entity): @@ -19618,6 +20119,26 @@ def __init__(self, *, value: List["_models.SecurityMLAnalyticsSetting"], **kwarg self.value = value +class SentinelEntityMapping(_serialization.Model): + """A single sentinel entity mapping. + + :ivar column_name: the column name to be mapped to the SentinelEntities. + :vartype column_name: str + """ + + _attribute_map = { + "column_name": {"key": "columnName", "type": "str"}, + } + + def __init__(self, *, column_name: Optional[str] = None, **kwargs): + """ + :keyword column_name: the column name to be mapped to the SentinelEntities. + :paramtype column_name: str + """ + super().__init__(**kwargs) + self.column_name = column_name + + class SentinelOnboardingState(ResourceWithEtag): """Sentinel onboarding state. diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_security_insights_enums.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_security_insights_enums.py index 8cce3c51b8f91..211307abea196 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_security_insights_enums.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_security_insights_enums.py @@ -28,6 +28,29 @@ class AlertDetail(str, Enum, metaclass=CaseInsensitiveEnumMeta): SEVERITY = "Severity" +class AlertProperty(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The V3 alert property.""" + + #: Alert's link + ALERT_LINK = "AlertLink" + #: Confidence level property + CONFIDENCE_LEVEL = "ConfidenceLevel" + #: Confidence score + CONFIDENCE_SCORE = "ConfidenceScore" + #: Extended links to the alert + EXTENDED_LINKS = "ExtendedLinks" + #: Product name alert property + PRODUCT_NAME = "ProductName" + #: Provider name alert property + PROVIDER_NAME = "ProviderName" + #: Product component name alert property + PRODUCT_COMPONENT_NAME = "ProductComponentName" + #: Remediation steps alert property + REMEDIATION_STEPS = "RemediationSteps" + #: Techniques alert property + TECHNIQUES = "Techniques" + + class AlertRuleKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the alert rule.""" @@ -309,6 +332,21 @@ class AutomationRulePropertyConditionSupportedProperty(str, Enum, metaclass=Case URL = "Url" +class Category(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Categories of recommendations.""" + + #: Onboarding recommendation. + ONBOARDING = "Onboarding" + #: New feature recommendation. + NEW_FEATURE = "NewFeature" + #: Soc Efficiency recommendation. + SOC_EFFICIENCY = "SocEfficiency" + #: Cost optimization recommendation. + COST_OPTIMIZATION = "CostOptimization" + #: Demo recommendation. + DEMO = "Demo" + + class ConditionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ConditionType.""" @@ -372,6 +410,19 @@ class ContentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): WORKBOOK = "Workbook" +class Context(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Context of recommendation.""" + + #: Analytics context. + ANALYTICS = "Analytics" + #: Incidents context. + INCIDENTS = "Incidents" + #: Overview context. + OVERVIEW = "Overview" + #: No context. + NONE = "None" + + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource.""" @@ -866,7 +917,7 @@ class IngestionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): class KillChainIntent(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Holds the alert intent stage(s) mapping for this alert.""" + """The intent of the alert.""" #: The default value. UNKNOWN = "Unknown" @@ -1047,6 +1098,17 @@ class PollingFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): ONCE_A_DAY = "OnceADay" +class Priority(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Priority of recommendation.""" + + #: Low priority for recommendation. + LOW = "Low" + #: Medium priority for recommendation. + MEDIUM = "Medium" + #: High priority for recommendation. + HIGH = "High" + + class ProviderName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provider name.""" @@ -1161,6 +1223,21 @@ class SourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): REMOTE_STORAGE = "Remote storage" +class State(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of recommendation.""" + + #: Recommendation is active. + ACTIVE = "Active" + #: Recommendation is disabled. + DISABLED = "Disabled" + #: Recommendation has been completed by user. + COMPLETED_BY_USER = "CompletedByUser" + #: Recommendation has been completed by action. + COMPLETED_BY_ACTION = "CompletedByAction" + #: Recommendation is hidden. + HIDDEN = "Hidden" + + class SupportTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of support for content item.""" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/__init__.py index 918cd7e781bc8..383b3752d7717 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/__init__.py @@ -32,6 +32,9 @@ from ._product_settings_operations import ProductSettingsOperations from ._source_control_operations import SourceControlOperations from ._source_controls_operations import SourceControlsOperations +from ._get_recommendations_operations import GetRecommendationsOperations +from ._get_operations import GetOperations +from ._update_operations import UpdateOperations from ._threat_intelligence_indicator_operations import ThreatIntelligenceIndicatorOperations from ._threat_intelligence_indicators_operations import ThreatIntelligenceIndicatorsOperations from ._threat_intelligence_indicator_metrics_operations import ThreatIntelligenceIndicatorMetricsOperations @@ -72,6 +75,9 @@ "ProductSettingsOperations", "SourceControlOperations", "SourceControlsOperations", + "GetRecommendationsOperations", + "GetOperations", + "UpdateOperations", "ThreatIntelligenceIndicatorOperations", "ThreatIntelligenceIndicatorsOperations", "ThreatIntelligenceIndicatorMetricsOperations", diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_actions_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_actions_operations.py index 68422300a7586..e1fc8b94359ee 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_actions_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_actions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_by_alert_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +83,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +120,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -149,7 +160,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +231,9 @@ def list_by_alert_rule( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ActionsList] error_map = { @@ -247,10 +262,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -312,7 +334,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ActionResponse] request = build_get_request( @@ -458,7 +482,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.ActionResponse] @@ -541,7 +567,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_templates_operations.py index e29086482044d..2f6d303311860 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_templates_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_templates_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +82,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,7 +150,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertRuleTemplatesList] error_map = { @@ -169,10 +180,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -232,7 +250,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertRuleTemplate] request = build_get_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py index 024f59ae6b19e..cb8de5cec2c11 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +82,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +118,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -146,7 +157,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,7 +223,9 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertRulesList] error_map = { @@ -238,10 +253,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -299,7 +321,9 @@ def get(self, resource_group_name: str, workspace_name: str, rule_id: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertRule] request = build_get_request( @@ -435,7 +459,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertRule] @@ -515,7 +541,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_automation_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_automation_rules_operations.py index 54b991e5196b4..abd87f4d97dac 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_automation_rules_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_automation_rules_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -34,6 +34,10 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +52,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +88,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -119,7 +127,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +163,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -228,7 +240,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationRule] request = build_get_request( @@ -365,7 +379,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationRule] @@ -446,7 +462,9 @@ def delete(self, resource_group_name: str, workspace_name: str, automation_rule_ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[JSON] request = build_delete_request( @@ -502,7 +520,9 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationRulesList] error_map = { @@ -530,10 +550,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_operations.py index be478a9a5e9b1..f7910b0845e87 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_expand_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -194,7 +201,9 @@ def expand( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.BookmarkExpandResponse] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_relations_operations.py index 580e871e5d03e..583268a9882c9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_relations_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +105,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -138,7 +147,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -181,7 +192,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +283,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RelationList] error_map = { @@ -303,10 +318,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -368,7 +390,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Relation] request = build_get_request( @@ -514,7 +538,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Relation] @@ -597,7 +623,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmarks_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmarks_operations.py index 573200dfc9399..6ca1b1c13cb5c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmarks_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmarks_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +82,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +118,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -146,7 +157,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,7 +223,9 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.BookmarkList] error_map = { @@ -238,10 +253,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -299,7 +321,9 @@ def get(self, resource_group_name: str, workspace_name: str, bookmark_id: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Bookmark] request = build_get_request( @@ -435,7 +459,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Bookmark] @@ -515,7 +541,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_check_requirements_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_check_requirements_operations.py index 323c159e7d74e..2a84733478090 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_check_requirements_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_check_requirements_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_post_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -186,7 +193,9 @@ def post( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.DataConnectorRequirementsState] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py index 27a3e027a9879..f15f891529bb2 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +82,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +118,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -146,7 +157,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +193,9 @@ def build_connect_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -217,7 +232,9 @@ def build_disconnect_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -281,7 +298,9 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.DataConnectorList] error_map = { @@ -309,10 +328,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -372,7 +398,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.DataConnector] request = build_get_request( @@ -508,7 +536,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.DataConnector] @@ -588,7 +618,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -720,7 +752,9 @@ def connect( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] @@ -792,7 +826,9 @@ def disconnect( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_disconnect_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_domain_whois_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_domain_whois_operations.py index fe03697e9fd76..2826d78c47dc3 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_domain_whois_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_domain_whois_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_request(resource_group_name: str, subscription_id: str, *, domain: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +116,9 @@ def get(self, resource_group_name: str, domain: str, **kwargs: Any) -> _models.E _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EnrichmentDomainWhois] request = build_get_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_get_timeline_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_get_timeline_operations.py index 35ef9cb26f800..47cdc78fb05aa 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_get_timeline_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_get_timeline_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -194,7 +201,9 @@ def list( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityTimelineResponse] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_operations.py index e00566fc987ee..dbb19d83c20c6 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +82,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +118,9 @@ def build_expand_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -146,13 +157,15 @@ def build_queries_request( entity_id: str, subscription_id: str, *, - kind: Union[str, "_models.EntityItemQueryKind"], + kind: Union[str, _models.EntityItemQueryKind], **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -187,7 +200,9 @@ def build_get_insights_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -254,7 +269,9 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityList] error_map = { @@ -282,10 +299,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -343,7 +367,9 @@ def get(self, resource_group_name: str, workspace_name: str, entity_id: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Entity] request = build_get_request( @@ -482,7 +508,9 @@ def expand( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityExpandResponse] @@ -535,7 +563,7 @@ def queries( resource_group_name: str, workspace_name: str, entity_id: str, - kind: Union[str, "_models.EntityItemQueryKind"], + kind: Union[str, _models.EntityItemQueryKind], **kwargs: Any ) -> _models.GetQueriesResponse: """Get Insights and Activities for an entity. @@ -565,7 +593,9 @@ def queries( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GetQueriesResponse] request = build_queries_request( @@ -703,7 +733,9 @@ def get_insights( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityGetInsightsResponse] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_relations_operations.py index a59f094b4554c..d78efc797c82f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_relations_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,7 +154,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RelationList] error_map = { @@ -180,10 +189,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_queries_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_queries_operations.py index 79b606bd344ab..79ceb8bd6691c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_queries_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_queries_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,13 +46,15 @@ def build_list_request( workspace_name: str, subscription_id: str, *, - kind: Optional[Union[str, "_models.Enum13"]] = None, + kind: Optional[Union[str, _models.Enum13]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +89,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +125,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -153,7 +164,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +218,7 @@ def list( self, resource_group_name: str, workspace_name: str, - kind: Optional[Union[str, "_models.Enum13"]] = None, + kind: Optional[Union[str, _models.Enum13]] = None, **kwargs: Any ) -> Iterable["_models.EntityQuery"]: """Gets all entity queries. @@ -226,7 +239,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityQueryList] error_map = { @@ -255,10 +270,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -318,7 +340,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityQuery] request = build_get_request( @@ -455,7 +479,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityQuery] @@ -535,7 +561,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_query_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_query_templates_operations.py index f382f7e47b411..b0c03c6be078e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_query_templates_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_query_templates_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,13 +46,15 @@ def build_list_request( workspace_name: str, subscription_id: str, *, - kind: Optional[Union[str, "_models.Enum15"]] = None, + kind: Optional[Union[str, _models.Enum15]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +89,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +143,7 @@ def list( self, resource_group_name: str, workspace_name: str, - kind: Optional[Union[str, "_models.Enum15"]] = None, + kind: Optional[Union[str, _models.Enum15]] = None, **kwargs: Any ) -> Iterable["_models.EntityQueryTemplate"]: """Gets all entity query templates. @@ -154,7 +163,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityQueryTemplateList] error_map = { @@ -183,10 +194,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -246,7 +264,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityQueryTemplate] request = build_get_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_relations_operations.py index b6fe9f3be2bd5..3fc67f210e7b0 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_relations_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,9 @@ def build_get_relation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +131,9 @@ def get_relation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Relation] request = build_get_relation_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_file_imports_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_file_imports_operations.py index 0f3781eda127d..6ced49c17d759 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_file_imports_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_file_imports_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +57,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +100,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +136,9 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -164,7 +175,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -249,7 +262,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.FileImportList] error_map = { @@ -281,10 +296,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -344,7 +366,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.FileImport] request = build_get_request( @@ -480,7 +504,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.FileImport] @@ -541,7 +567,9 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.FileImport]] request = build_delete_request( @@ -606,7 +634,9 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.FileImport] polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_operations.py new file mode 100644 index 0000000000000..96fe4e84f9070 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_operations.py @@ -0,0 +1,161 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_single_recommendation_request( + resource_group_name: str, workspace_name: str, recommendation_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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations/{recommendationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=90, min_length=1), + "recommendationId": _SERIALIZER.url("recommendation_id", recommendation_id, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_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 GetOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`get` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def single_recommendation( + self, resource_group_name: str, workspace_name: str, recommendation_id: str, **kwargs: Any + ) -> _models.Recommendation: + """Gets a recommendation by its id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param recommendation_id: Recommendation Id. Required. + :type recommendation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Recommendation or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Recommendation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Recommendation] + + request = build_single_recommendation_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + recommendation_id=recommendation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.single_recommendation.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Recommendation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + single_recommendation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations/{recommendationId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_recommendations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_recommendations_operations.py new file mode 100644 index 0000000000000..89a8155190a38 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_recommendations_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, workspace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_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 GetRecommendationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`get_recommendations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.RecommendationList: + """Gets a list of all recommendations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecommendationList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.RecommendationList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecommendationList] + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RecommendationList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py index f38cf7bc61e47..0ce4d73ba19d1 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +105,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -138,7 +147,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -181,7 +192,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +283,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentCommentList] error_map = { @@ -303,10 +318,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -368,7 +390,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentComment] request = build_get_request( @@ -514,7 +538,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentComment] @@ -597,7 +623,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_relations_operations.py index 564d3208efbcb..c4d23d8e4b778 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_relations_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +105,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -138,7 +147,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -181,7 +192,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +283,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RelationList] error_map = { @@ -303,10 +318,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -368,7 +390,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Relation] request = build_get_request( @@ -514,7 +538,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Relation] @@ -597,7 +623,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py index 010be31f272a2..5b244c206fc95 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -34,6 +34,10 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +52,9 @@ def build_run_playbook_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -93,7 +99,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +142,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +178,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -205,7 +217,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +253,9 @@ def build_create_team_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -276,7 +292,9 @@ def build_list_alerts_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +328,9 @@ def build_list_bookmarks_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -344,7 +364,9 @@ def build_list_entities_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -492,7 +514,9 @@ def run_playbook( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[JSON] @@ -580,7 +604,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentList] error_map = { @@ -612,10 +638,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -673,7 +706,9 @@ def get(self, resource_group_name: str, workspace_name: str, incident_id: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Incident] request = build_get_request( @@ -809,7 +844,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Incident] @@ -889,7 +926,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -1024,7 +1063,9 @@ def create_team( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.TeamInformation] @@ -1100,7 +1141,9 @@ def list_alerts( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentAlertList] request = build_list_alerts_request( @@ -1164,7 +1207,9 @@ def list_bookmarks( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentBookmarkList] request = build_list_bookmarks_request( @@ -1228,7 +1273,9 @@ def list_entities( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IncidentEntitiesResponse] request = build_list_entities_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_ip_geodata_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_ip_geodata_operations.py index ba526e5c4ee03..441b4e30811dc 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_ip_geodata_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_ip_geodata_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_request(resource_group_name: str, subscription_id: str, *, ip_addr _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +116,9 @@ def get(self, resource_group_name: str, ip_address: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.EnrichmentIpGeodata] request = build_get_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_metadata_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_metadata_operations.py index 8d26c879182da..2d5877e7d30af 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_metadata_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_metadata_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +98,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +134,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +170,9 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -196,7 +209,9 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -282,7 +297,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataList] error_map = { @@ -314,10 +331,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -377,7 +401,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataModel] request = build_get_request( @@ -441,7 +467,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -573,7 +601,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataModel] @@ -725,7 +755,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataModel] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_office_consents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_office_consents_operations.py index 5ca19c4f68246..b972f71dc5107 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_office_consents_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_office_consents_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +82,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +118,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +184,9 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.OfficeConsentList] error_map = { @@ -201,10 +214,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -264,7 +284,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.OfficeConsent] request = build_get_request( @@ -328,7 +350,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py index 9718672b9d723..f0ee5a2835118 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +93,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationsList] error_map = { @@ -111,10 +120,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_settings_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_settings_operations.py index 29465781367bf..fa32181568871 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_settings_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_settings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +80,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +116,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,7 +152,9 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -216,7 +229,9 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingList] request = build_list_request( @@ -278,7 +293,9 @@ def get(self, resource_group_name: str, workspace_name: str, settings_name: str, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Settings] request = build_get_request( @@ -343,7 +360,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -478,7 +497,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Settings] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_security_ml_analytics_settings_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_security_ml_analytics_settings_operations.py index 3dc326f5af86b..e1a537d5b5117 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_security_ml_analytics_settings_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_security_ml_analytics_settings_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +82,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +118,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -146,7 +157,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,7 +227,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityMLAnalyticsSettingsList] error_map = { @@ -242,10 +257,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -305,7 +327,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityMLAnalyticsSetting] request = build_get_request( @@ -444,7 +468,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityMLAnalyticsSetting] @@ -524,7 +550,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_sentinel_onboarding_states_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_sentinel_onboarding_states_operations.py index 0e174459500db..dc82d25e60df9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_sentinel_onboarding_states_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_sentinel_onboarding_states_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +49,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +91,9 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -127,7 +136,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +174,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +252,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SentinelOnboardingState] request = build_get_request( @@ -383,7 +398,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SentinelOnboardingState] @@ -467,7 +484,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -525,7 +544,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SentinelOnboardingStatesList] request = build_list_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_control_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_control_operations.py index f822543d6372c..8354dfc1da873 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_control_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_control_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,13 +46,15 @@ def build_list_repositories_request( workspace_name: str, subscription_id: str, *, - json: Union[str, "_models.RepoType"], + json: Union[str, _models.RepoType], **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -98,7 +105,7 @@ def __init__(self, *args, **kwargs): @distributed_trace def list_repositories( - self, resource_group_name: str, workspace_name: str, repo_type: Union[str, "_models.RepoType"], **kwargs: Any + self, resource_group_name: str, workspace_name: str, repo_type: Union[str, _models.RepoType], **kwargs: Any ) -> Iterable["_models.Repo"]: """Gets a list of repositories metadata. @@ -117,7 +124,9 @@ def list_repositories( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str cls = kwargs.pop("cls", None) # type: ClsType[_models.RepoList] @@ -149,10 +158,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_controls_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_controls_operations.py index 5827e38da641e..65df5281786f9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_controls_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_controls_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +82,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +118,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +154,9 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -210,7 +223,9 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SourceControlList] error_map = { @@ -238,10 +253,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -301,7 +323,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SourceControl] request = build_get_request( @@ -365,7 +389,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -497,7 +523,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SourceControl] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_metrics_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_metrics_operations.py index 567f9966b89c5..ed3442239f18e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_metrics_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_metrics_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +120,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceMetricsList] request = build_list_request( diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_operations.py index f8eb6ec233947..6b580dd65f4bd 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_create_indicator_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -78,7 +85,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +121,9 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -149,7 +160,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +196,9 @@ def build_query_indicators_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -219,7 +234,9 @@ def build_append_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -256,7 +273,9 @@ def build_replace_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -403,7 +422,9 @@ def create_indicator( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceInformation] @@ -482,7 +503,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceInformation] request = build_get_request( @@ -623,7 +646,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceInformation] @@ -703,7 +728,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -829,7 +856,9 @@ def query_indicators( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceInformationList] @@ -868,10 +897,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1008,7 +1044,9 @@ def append_tags( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] @@ -1157,7 +1195,9 @@ def replace_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceInformation] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicators_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicators_operations.py index ba8d5e15db9bf..36cccfc22c1b1 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicators_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicators_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +151,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ThreatIntelligenceInformationList] error_map = { @@ -176,10 +185,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_update_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_update_operations.py new file mode 100644 index 0000000000000..eca89b36b131c --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_update_operations.py @@ -0,0 +1,332 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_recommendation_request( + resource_group_name: str, workspace_name: str, recommendation_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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations/{recommendationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=90, min_length=1), + "recommendationId": _SERIALIZER.url("recommendation_id", recommendation_id, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class UpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`update` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _recommendation_initial( + self, + resource_group_name: str, + workspace_name: str, + recommendation_id: str, + recommendation_patch: Union[List[_models.RecommendationPatch], IO], + **kwargs: Any + ) -> _models.Recommendation: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Recommendation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(recommendation_patch, (IO, bytes)): + _content = recommendation_patch + else: + _json = self._serialize.body(recommendation_patch, "[RecommendationPatch]") + + request = build_recommendation_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + recommendation_id=recommendation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._recommendation_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Recommendation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _recommendation_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations/{recommendationId}"} # type: ignore + + @overload + def begin_recommendation( + self, + resource_group_name: str, + workspace_name: str, + recommendation_id: str, + recommendation_patch: List[_models.RecommendationPatch], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Recommendation]: + """Patch a recommendation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param recommendation_id: Recommendation Id. Required. + :type recommendation_id: str + :param recommendation_patch: Recommendation Fields to Update. Required. + :type recommendation_patch: list[~azure.mgmt.securityinsight.models.RecommendationPatch] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Recommendation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.securityinsight.models.Recommendation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_recommendation( + self, + resource_group_name: str, + workspace_name: str, + recommendation_id: str, + recommendation_patch: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Recommendation]: + """Patch a recommendation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param recommendation_id: Recommendation Id. Required. + :type recommendation_id: str + :param recommendation_patch: Recommendation Fields to Update. Required. + :type recommendation_patch: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Recommendation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.securityinsight.models.Recommendation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_recommendation( + self, + resource_group_name: str, + workspace_name: str, + recommendation_id: str, + recommendation_patch: Union[List[_models.RecommendationPatch], IO], + **kwargs: Any + ) -> LROPoller[_models.Recommendation]: + """Patch a recommendation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param recommendation_id: Recommendation Id. Required. + :type recommendation_id: str + :param recommendation_patch: Recommendation Fields to Update. Is either a list type or a IO + type. Required. + :type recommendation_patch: list[~azure.mgmt.securityinsight.models.RecommendationPatch] or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Recommendation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.securityinsight.models.Recommendation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Recommendation] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._recommendation_initial( # type: ignore + resource_group_name=resource_group_name, + workspace_name=workspace_name, + recommendation_id=recommendation_id, + recommendation_patch=recommendation_patch, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Recommendation", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_recommendation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations/{recommendationId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlist_items_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlist_items_operations.py index 10c70187b33fd..691aa8f9fec00 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlist_items_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlist_items_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +96,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +138,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,7 +180,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -251,7 +264,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.WatchlistItemList] error_map = { @@ -281,10 +296,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -346,7 +368,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.WatchlistItem] request = build_get_request( @@ -413,7 +437,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -555,7 +581,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.WatchlistItem] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlists_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlists_operations.py index 3a2b8bdce0828..1cbe7308e103b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlists_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlists_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +89,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +125,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +161,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-11-01-preview") + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -224,7 +237,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.WatchlistList] error_map = { @@ -253,10 +268,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -316,7 +338,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Watchlist] request = build_get_request( @@ -380,7 +404,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -533,7 +559,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) # type: Literal["2022-11-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Watchlist] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_create_or_update.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_create_or_update.py new file mode 100644 index 0000000000000..5b91d90999e9b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_create_or_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python automation_rules_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.automation_rules.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + automation_rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/automationRules/AutomationRules_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_delete.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_delete.py new file mode 100644 index 0000000000000..cc401a9c2d1f8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python automation_rules_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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.automation_rules.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + automation_rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/automationRules/AutomationRules_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_get.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_get.py new file mode 100644 index 0000000000000..1e84dae06767a --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python automation_rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.automation_rules.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + automation_rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/automationRules/AutomationRules_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_list.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_list.py new file mode 100644 index 0000000000000..46284f1191bce --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python automation_rules_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.automation_rules.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/automationRules/AutomationRules_List.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_an_api_polling_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_an_api_polling_data_connector.py new file mode 100644 index 0000000000000..26316e36a6382 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_an_api_polling_data_connector.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python connect_an_api_polling_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.connect( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", + connect_body={ + "apiKey": "123456789", + "kind": "APIKey", + "requestConfigUserInputValues": [ + { + "displayText": "Organization Name", + "placeHolderName": "{{placeHolder1}}", + "placeHolderValue": "somePlaceHolderValue", + "requestObjectKey": "apiEndpoint", + } + ], + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/ConnectAPIPolling.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_an_api_polling_v2_logs_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_an_api_polling_v2_logs_data_connector.py new file mode 100644 index 0000000000000..3e1edf38572c7 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_an_api_polling_v2_logs_data_connector.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python connect_an_api_polling_v2_logs_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.connect( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", + connect_body={ + "apiKey": "123456789", + "dataCollectionEndpoint": "https://test.eastus.ingest.monitor.azure.com", + "dataCollectionRuleImmutableId": "dcr-34adsj9o7d6f9de204478b9cgb43b631", + "kind": "APIKey", + "outputStream": "Custom-MyTableRawData", + "requestConfigUserInputValues": [ + { + "displayText": "Organization Name", + "placeHolderName": "{{placeHolder1}}", + "placeHolderValue": "somePlaceHolderValue", + "requestObjectKey": "apiEndpoint", + } + ], + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/ConnectAPIPollingV2Logs.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create/update_full_metadata..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create/update_full_metadata..py new file mode 100644 index 0000000000000..129afd3537439 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create/update_full_metadata..py @@ -0,0 +1,95 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create/update_full_metadata..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.metadata.create( + resource_group_name="myRg", + workspace_name="myWorkspace", + metadata_name="metadataName", + metadata={ + "properties": { + "author": {"email": "email@microsoft.com", "name": "User Name"}, + "categories": {"domains": ["Application", "Security – Insider Threat"], "verticals": ["Healthcare"]}, + "contentId": "c00ee137-7475-47c8-9cce-ec6f0f1bedd0", + "contentSchemaVersion": "2.0", + "customVersion": "1.0", + "dependencies": { + "criteria": [ + { + "criteria": [ + { + "contentId": "045d06d0-ee72-4794-aba4-cf5646e4c756", + "kind": "DataConnector", + "name": "Microsoft Defender for Endpoint", + }, + {"contentId": "dbfcb2cc-d782-40ef-8d94-fe7af58a6f2d", "kind": "DataConnector"}, + { + "contentId": "de4dca9b-eb37-47d6-a56f-b8b06b261593", + "kind": "DataConnector", + "version": "2.0", + }, + ], + "operator": "OR", + }, + {"contentId": "31ee11cc-9989-4de8-b176-5e0ef5c4dbab", "kind": "Playbook", "version": "1.0"}, + {"contentId": "21ba424a-9438-4444-953a-7059539a7a1b", "kind": "Parser"}, + ], + "operator": "AND", + }, + "firstPublishDate": "2021-05-18", + "kind": "AnalyticsRule", + "lastPublishDate": "2021-05-18", + "parentId": "/subscriptions/2e1dc338-d04d-4443-b721-037eff4fdcac/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/ruleName", + "previewImages": ["firstImage.png", "secondImage.jpeg"], + "previewImagesDark": ["firstImageDark.png", "secondImageDark.jpeg"], + "providers": ["Amazon", "Microsoft"], + "source": { + "kind": "Solution", + "name": "Contoso Solution 1.0", + "sourceId": "b688a130-76f4-4a07-bf57-762222a3cadf", + }, + "support": { + "email": "support@microsoft.com", + "link": "https://support.microsoft.com/", + "name": "Microsoft", + "tier": "Partner", + }, + "threatAnalysisTactics": ["reconnaissance", "commandandcontrol"], + "threatAnalysisTechniques": ["T1548", "T1548.001"], + "version": "1.0.0.0", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/metadata/PutMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create/update_minimal_metadata..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create/update_minimal_metadata..py new file mode 100644 index 0000000000000..12828ff7b562b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create/update_minimal_metadata..py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create/update_minimal_metadata..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.metadata.create( + resource_group_name="myRg", + workspace_name="myWorkspace", + metadata_name="metadataName", + metadata={ + "properties": { + "contentId": "c00ee137-7475-47c8-9cce-ec6f0f1bedd0", + "kind": "AnalyticsRule", + "parentId": "/subscriptions/2e1dc338-d04d-4443-b721-037eff4fdcac/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/ruleName", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/metadata/PutMetadataMinimal.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_a_file_import..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_a_file_import..py new file mode 100644 index 0000000000000..446493562c76a --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_a_file_import..py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_a_file_import..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.file_imports.create( + resource_group_name="myRg", + workspace_name="myWorkspace", + file_import_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + file_import={ + "properties": { + "contentType": "StixIndicator", + "importFile": {"fileFormat": "JSON", "fileName": "myFile.json", "fileSize": 4653}, + "ingestionMode": "IngestAnyValidRecords", + "source": "mySource", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/fileImports/CreateFileImport.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_sentinel_onboarding_state.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_sentinel_onboarding_state.py new file mode 100644 index 0000000000000..8173163f4ed55 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_sentinel_onboarding_state.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_sentinel_onboarding_state.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.sentinel_onboarding_states.create( + resource_group_name="myRg", + workspace_name="myWorkspace", + sentinel_onboarding_state_name="default", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/onboardingStates/CreateSentinelOnboardingState.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_a_recommendation..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_a_recommendation..py new file mode 100644 index 0000000000000..ba07d0f2520a2 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_a_recommendation..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_a_recommendation..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.update.begin_recommendation( + resource_group_name="myRg", + workspace_name="myWorkspace", + recommendation_id="6d4b54eb-8684-4aa3-a156-3aa37b8014bc", + recommendation_patch=[{"state": "Active"}], + ).result() + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/recommendations/PatchRecommendation.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_a_source_control..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_a_source_control..py new file mode 100644 index 0000000000000..226939fe7d49b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_a_source_control..py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_a_source_control..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.source_controls.create( + resource_group_name="myRg", + workspace_name="myWorkspace", + source_control_id="789e0c1f-4a3d-43ad-809c-e713b677b04a", + source_control={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "properties": { + "contentTypes": ["AnalyticRules", "Workbook"], + "description": "This is a source control", + "displayName": "My Source Control", + "repoType": "Github", + "repository": { + "branch": "master", + "displayUrl": "https://github.com/user/repo", + "pathMapping": [ + {"contentType": "AnalyticRules", "path": "path/to/rules"}, + {"contentType": "Workbook", "path": "path/to/workbooks"}, + ], + "url": "https://github.com/user/repo", + }, + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/sourcecontrols/CreateSourceControl.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_incident_teams_group..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_incident_teams_group..py new file mode 100644 index 0000000000000..2e04b2695bc82 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_incident_teams_group..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_incident_teams_group..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="9023f5b5-df22-4313-8fbf-b4b75af8a6d9", + ) + + response = client.incidents.create_team( + resource_group_name="ambawolvese5resourcegroup", + workspace_name="AmbaE5WestCentralUS", + incident_id="69a30280-6a4c-4aa7-9af0-5d63f335d600", + team_properties={"teamDescription": "Team description", "teamName": "Team name"}, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/CreateTeam.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_api_polling_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_api_polling_data_connector.py new file mode 100644 index 0000000000000..f59be4e4d8f4a --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_api_polling_data_connector.py @@ -0,0 +1,126 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_api_polling_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", + data_connector={ + "kind": "APIPolling", + "properties": { + "connectorUiConfig": { + "availability": {"isPreview": True, "status": 1}, + "connectivityCriteria": [{"type": "SentinelKindsV2", "value": []}], + "dataTypes": [ + { + "lastDataReceivedQuery": "{{graphQueriesTableName}}\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)", + "name": "{{graphQueriesTableName}}", + } + ], + "descriptionMarkdown": "The GitHub audit log connector provides the capability to ingest GitHub logs into Azure Sentinel. By connecting GitHub audit logs into Azure Sentinel, you can view this data in workbooks, use it to create custom alerts, and improve your investigation process.", + "graphQueries": [ + { + "baseQuery": "{{graphQueriesTableName}}", + "legend": "GitHub audit log events", + "metricName": "Total events received", + } + ], + "graphQueriesTableName": "GitHubAuditLogPolling_CL", + "instructionSteps": [ + { + "description": "Enable GitHub audit Logs. \n Follow `this `_ to create or find your personal key", + "instructions": [ + { + "parameters": { + "enable": "true", + "userRequestPlaceHoldersInput": [ + { + "displayText": "Organization Name", + "placeHolderName": "{{placeHolder1}}", + "placeHolderValue": "", + "requestObjectKey": "apiEndpoint", + } + ], + }, + "type": "APIKey", + } + ], + "title": "Connect GitHub Enterprise Audit Log to Azure Sentinel", + } + ], + "permissions": { + "customs": [ + { + "description": "You need access to GitHub personal token, the key should have 'admin:org' scope", + "name": "GitHub API personal token Key", + } + ], + "resourceProvider": [ + { + "permissionsDisplayText": "read and write permissions are required.", + "provider": "Microsoft.OperationalInsights/workspaces", + "providerDisplayName": "Workspace", + "requiredPermissions": {"delete": True, "read": True, "write": True}, + "scope": "Workspace", + } + ], + }, + "publisher": "GitHub", + "sampleQueries": [ + {"description": "All logs", "query": "{{graphQueriesTableName}}\n | take 10 "} + ], + "title": "GitHub Enterprise Audit Log", + }, + "pollingConfig": { + "auth": {"apiKeyIdentifier": "token", "apiKeyName": "Authorization", "authType": "APIKey"}, + "paging": {"pageSizeParaName": "per_page", "pagingType": "LinkHeader"}, + "request": { + "apiEndpoint": "https://api.github.com/organizations/{{placeHolder1}}/audit-log", + "headers": {"Accept": "application/json", "User-Agent": "Scuba"}, + "httpMethod": "Get", + "queryParameters": {"phrase": "created:{_QueryWindowStartTime}..{_QueryWindowEndTime}"}, + "queryTimeFormat": "yyyy-MM-ddTHH:mm:ssZ", + "queryWindowInMin": 15, + "rateLimitQps": 50, + "retryCount": 2, + "timeoutInSeconds": 60, + }, + "response": {"eventsJsonPaths": ["$"]}, + }, + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/CreateAPIPolling.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_bookmark..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_bookmark..py new file mode 100644 index 0000000000000..202eea636ea56 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_bookmark..py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_bookmark..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.bookmarks.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + bookmark_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + bookmark={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "properties": { + "created": "2021-09-01T13:15:30Z", + "createdBy": {"objectId": "2046feea-040d-4a46-9e2b-91c2941bfa70"}, + "displayName": "My bookmark", + "entityMappings": [ + { + "entityType": "Account", + "fieldMappings": [{"identifier": "Fullname", "value": "johndoe@microsoft.com"}], + } + ], + "labels": ["Tag1", "Tag2"], + "notes": "Found a suspicious activity", + "query": "SecurityEvent | where TimeGenerated > ago(1d) and TimeGenerated < ago(2d)", + "queryResult": "Security Event query result", + "tactics": ["Execution"], + "techniques": ["T1609"], + "updated": "2021-09-01T13:15:30Z", + "updatedBy": {"objectId": "2046feea-040d-4a46-9e2b-91c2941bfa70"}, + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/bookmarks/CreateBookmark.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_bookmark_relation..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_bookmark_relation..py new file mode 100644 index 0000000000000..1ce67c2e7224d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_bookmark_relation..py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_bookmark_relation..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.bookmark_relations.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + bookmark_id="2216d0e1-91e3-4902-89fd-d2df8c535096", + relation_name="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", + relation={ + "properties": { + "relatedResourceId": "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/afbd324f-6c48-459c-8710-8d1e1cd03812" + } + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/bookmarks/relations/CreateBookmarkRelation.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_dynamics365_data_connector..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_dynamics365_data_connector..py new file mode 100644 index 0000000000000..4221820204d4b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_dynamics365_data_connector..py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_dynamics365_data_connector..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="c2541efb-c9a6-47fe-9501-87d1017d1512", + data_connector={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "kind": "Dynamics365", + "properties": { + "dataTypes": {"dynamics365CdsActivities": {"state": "Enabled"}}, + "tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/CreateDynamics365DataConnetor.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_fusion_alert_rule..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_fusion_alert_rule..py new file mode 100644 index 0000000000000..6d138abea327c --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_fusion_alert_rule..py @@ -0,0 +1,179 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_fusion_alert_rule..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.alert_rules.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="myFirstFusionRule", + alert_rule={ + "etag": "3d00c3ca-0000-0100-0000-5d42d5010000", + "kind": "Fusion", + "properties": { + "alertRuleTemplateName": "f71aba3d-28fb-450b-b192-4e76a83015c8", + "enabled": True, + "sourceSettings": [ + {"enabled": True, "sourceName": "Anomalies", "sourceSubTypes": None}, + { + "enabled": True, + "sourceName": "Alert providers", + "sourceSubTypes": [ + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Azure Active Directory Identity Protection", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Azure Defender", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Azure Defender for IoT", + }, + { + "enabled": True, + "severityFilter": ["High", "Medium", "Low", "Informational"], + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Microsoft 365 Defender", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Microsoft Cloud App Security", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Microsoft Defender for Endpoint", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Microsoft Defender for Identity", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Microsoft Defender for Office 365", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Azure Sentinel scheduled analytics rules", + }, + ], + }, + { + "enabled": True, + "sourceName": "Raw logs from other sources", + "sourceSubTypes": [ + { + "enabled": True, + "severityFilters": {"filters": None}, + "sourceSubTypeName": "Palo Alto Networks", + } + ], + }, + ], + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/alertRules/CreateFusionAlertRule.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_fusion_alert_rule_with_scenario_exclusion_pattern..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_fusion_alert_rule_with_scenario_exclusion_pattern..py new file mode 100644 index 0000000000000..7915e37c8d5b8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_fusion_alert_rule_with_scenario_exclusion_pattern..py @@ -0,0 +1,179 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_fusion_alert_rule_with_scenario_exclusion_pattern..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.alert_rules.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="myFirstFusionRule", + alert_rule={ + "etag": "3d00c3ca-0000-0100-0000-5d42d5010000", + "kind": "Fusion", + "properties": { + "alertRuleTemplateName": "f71aba3d-28fb-450b-b192-4e76a83015c8", + "enabled": True, + "sourceSettings": [ + {"enabled": True, "sourceName": "Anomalies", "sourceSubTypes": None}, + { + "enabled": True, + "sourceName": "Alert providers", + "sourceSubTypes": [ + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Azure Active Directory Identity Protection", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Azure Defender", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Azure Defender for IoT", + }, + { + "enabled": True, + "severityFilter": ["High", "Medium", "Low", "Informational"], + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Microsoft 365 Defender", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Microsoft Cloud App Security", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Microsoft Defender for Endpoint", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Microsoft Defender for Identity", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Microsoft Defender for Office 365", + }, + { + "enabled": True, + "severityFilters": { + "filters": [ + {"enabled": True, "severity": "High"}, + {"enabled": True, "severity": "Medium"}, + {"enabled": True, "severity": "Low"}, + {"enabled": True, "severity": "Informational"}, + ] + }, + "sourceSubTypeName": "Azure Sentinel scheduled analytics rules", + }, + ], + }, + { + "enabled": True, + "sourceName": "Raw logs from other sources", + "sourceSubTypes": [ + { + "enabled": True, + "severityFilters": {"filters": None}, + "sourceSubTypeName": "Palo Alto Networks", + } + ], + }, + ], + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/alertRules/CreateFusionAlertRuleWithFusionScenarioExclusion.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_generic_ui_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_generic_ui_data_connector.py new file mode 100644 index 0000000000000..14e0b0dd6adad --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_generic_ui_data_connector.py @@ -0,0 +1,161 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_generic_ui_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", + data_connector={ + "kind": "GenericUI", + "properties": { + "connectorUiConfig": { + "availability": {"isPreview": True, "status": 1}, + "connectivityCriteria": [ + { + "type": "IsConnectedQuery", + "value": [ + "{{graphQueriesTableName}}\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(30d)" + ], + } + ], + "dataTypes": [ + { + "lastDataReceivedQuery": "{{graphQueriesTableName}}\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)", + "name": "{{graphQueriesTableName}}", + } + ], + "descriptionMarkdown": "The [Qualys Vulnerability Management (VM)](https://www.qualys.com/apps/vulnerability-management/) data connector provides the capability to ingest vulnerability host detection data into Azure Sentinel through the Qualys API. The connector provides visibility into host detection data from vulerability scans. This connector provides Azure Sentinel the capability to view dashboards, create custom alerts, and improve investigation ", + "graphQueries": [ + { + "baseQuery": "{{graphQueriesTableName}}", + "legend": "{{graphQueriesTableName}}", + "metricName": "Total data received", + } + ], + "graphQueriesTableName": "QualysHostDetection_CL", + "instructionSteps": [ + { + "description": "..\n\n **NOTE:** This connector uses Azure Functions to connect to Qualys VM to pull its logs into Azure Sentinel. This might result in additional data ingestion costs. Check the `Azure Functions pricing page `_ for details.", + "title": "", + }, + { + "description": "..\n\n **(Optional Step)** Securely store workspace and API authorization key(s) or token(s) in Azure Key Vault. Azure Key Vault provides a secure mechanism to store and retrieve key values. `Follow these instructions `_ to use Azure Key Vault with an Azure Function App.", + "title": "", + }, + { + "description": "**STEP 1 - Configuration steps for the Qualys VM API**\n\n\n#. Log into the Qualys Vulnerability Management console with an administrator account, select the **Users** tab and the **Users** subtab. \n#. Click on the **New** drop-down menu and select **Users..**\n#. Create a username and password for the API account. \n#. In the **User Roles** tab, ensure the account role is set to **Manager** and access is allowed to **GUI** and **API**\n#. Log out of the administrator account and log into the console with the new API credentials for validation, then log out of the API account. \n#. Log back into the console using an administrator account and modify the API accounts User Roles, removing access to **GUI**. \n#. Save all changes.", + "title": "", + }, + { + "description": "**STEP 2 - Choose ONE from the following two deployment options to deploy the connector and the associated Azure Function**\n\n..\n\n **IMPORTANT:** Before deploying the Qualys VM connector, have the Workspace ID and Workspace Primary Key (can be copied from the following), as well as the Qualys VM API Authorization Key(s), readily available.", + "instructions": [ + { + "parameters": {"fillWith": ["WorkspaceId"], "label": "Workspace ID"}, + "type": "CopyableLabel", + }, + { + "parameters": {"fillWith": ["PrimaryKey"], "label": "Primary Key"}, + "type": "CopyableLabel", + }, + ], + "title": "", + }, + { + "description": 'Use this method for automated deployment of the Qualys VM connector using an ARM Tempate.\n\n\n#. \n Click the **Deploy to Azure** button below. \n\n \n .. image:: https://aka.ms/deploytoazurebutton\n :target: https://aka.ms/sentinelqualysvmazuredeploy\n :alt: Deploy To Azure\n\n\n#. Select the preferred **Subscription**\\ , **Resource Group** and **Location**. \n#. Enter the **Workspace ID**\\ , **Workspace Key**\\ , **API Username**\\ , **API Password** , update the **URI**\\ , and any additional URI **Filter Parameters** (each filter should be separated by an "&" symbol, no spaces.) \n ..\n\n * Enter the URI that corresponds to your region. The complete list of API Server URLs can be `found here `_ -- There is no need to add a time suffix to the URI, the Function App will dynamically append the Time Value to the URI in the proper format. \n * The default **Time Interval** is set to pull the last five (5) minutes of data. If the time interval needs to be modified, it is recommended to change the Function App Timer Trigger accordingly (in the function.json file, post deployment) to prevent overlapping data ingestion. \n * Note: If using Azure Key Vault secrets for any of the values above, use the\\ ``@Microsoft.KeyVault(SecretUri={Security Identifier})``\\ schema in place of the string values. Refer to `Key Vault references documentation `_ for further details. \n\n\n#. Mark the checkbox labeled **I agree to the terms and conditions stated above**. \n#. Click **Purchase** to deploy.', + "title": "Option 1 - Azure Resource Manager (ARM) Template", + }, + { + "description": "Use the following step-by-step instructions to deploy the Quayls VM connector manually with Azure Functions.", + "title": "Option 2 - Manual Deployment of Azure Functions", + }, + { + "description": "**1. Create a Function App**\n\n\n#. From the Azure Portal, navigate to `Function App `_\\ , and select **+ Add**.\n#. In the **Basics** tab, ensure Runtime stack is set to **Powershell Core**. \n#. In the **Hosting** tab, ensure the **Consumption (Serverless)** plan type is selected.\n#. Make other preferrable configuration changes, if needed, then click **Create**.", + "title": "", + }, + { + "description": "**2. Import Function App Code**\n\n\n#. In the newly created Function App, select **Functions** on the left pane and click **+ New Function**.\n#. Select **Timer Trigger**.\n#. Enter a unique Function **Name** and leave the default cron schedule of every 5 minutes, then click **Create**.\n#. Click on **Code + Test** on the left pane. \n#. Copy the `Function App Code `_ and paste into the Function App ``run.ps1`` editor.\n#. Click **Save**.", + "title": "", + }, + { + "description": '**3. Configure the Function App**\n\n\n#. In the Function App, select the Function App Name and select **Configuration**.\n#. In the **Application settings** tab, select **+ New application setting**.\n#. Add each of the following seven (7) application settings individually, with their respective string values (case-sensitive): \n .. code-block::\n\n apiUsername\n apiPassword\n workspaceID\n workspaceKey\n uri\n filterParameters\n timeInterval\n\n ..\n\n * Enter the URI that corresponds to your region. The complete list of API Server URLs can be `found here `_. The ``uri`` value must follow the following schema: ``https:///api/2.0/fo/asset/host/vm/detection/?action=list&vm_processed_after=`` -- There is no need to add a time suffix to the URI, the Function App will dynamically append the Time Value to the URI in the proper format.\n * Add any additional filter parameters, for the ``filterParameters`` variable, that need to be appended to the URI. Each parameter should be seperated by an "&" symbol and should not include any spaces.\n * Set the ``timeInterval`` (in minutes) to the value of ``5`` to correspond to the Timer Trigger of every ``5`` minutes. If the time interval needs to be modified, it is recommended to change the Function App Timer Trigger accordingly to prevent overlapping data ingestion.\n * Note: If using Azure Key Vault, use the\\ ``@Microsoft.KeyVault(SecretUri={Security Identifier})``\\ schema in place of the string values. Refer to `Key Vault references documentation `_ for further details.\n\n\n#. Once all application settings have been entered, click **Save**.', + "title": "", + }, + { + "description": '**4. Configure the host.json**.\n\nDue to the potentially large amount of Qualys host detection data being ingested, it can cause the execution time to surpass the default Function App timeout of five (5) minutes. Increase the default timeout duration to the maximum of ten (10) minutes, under the Consumption Plan, to allow more time for the Function App to execute.\n\n\n#. In the Function App, select the Function App Name and select the **App Service Editor** blade.\n#. Click **Go** to open the editor, then select the **host.json** file under the **wwwroot** directory.\n#. Add the line ``"functionTimeout": "00:10:00",`` above the ``managedDependancy`` line \n#. Ensure **SAVED** appears on the top right corner of the editor, then exit the editor.\n\n..\n\n NOTE: If a longer timeout duration is required, consider upgrading to an `App Service Plan `_', + "title": "", + }, + ], + "permissions": { + "customs": [ + { + "description": "Read and write permissions to Azure Functions to create a Function App is required. `See the documentation to learn more about Azure Functions `_.", + "name": "Microsoft.Web/sites permissions", + }, + { + "description": "A Qualys VM API username and password is required. `See the documentation to learn more about Qualys VM API `_.", + "name": "Qualys API Key", + }, + ], + "resourceProvider": [ + { + "permissionsDisplayText": "read and write permissions on the workspace are required.", + "provider": "Microsoft.OperationalInsights/workspaces", + "providerDisplayName": "Workspace", + "requiredPermissions": {"delete": True, "read": True, "write": True}, + "scope": "Workspace", + }, + { + "permissionsDisplayText": "read permissions to shared keys for the workspace are required. [See the documentation to learn more about workspace keys](https://docs.microsoft.com/azure/azure-monitor/platform/agent-windows#obtain-workspace-id-and-key).", + "provider": "Microsoft.OperationalInsights/workspaces/sharedKeys", + "providerDisplayName": "Keys", + "requiredPermissions": {"action": True}, + "scope": "Workspace", + }, + ], + }, + "publisher": "Qualys", + "sampleQueries": [ + { + "description": "Top 10 Vulerabilities detected", + "query": "{{graphQueriesTableName}}\n | mv-expand todynamic(Detections_s)\n | extend Vulnerability = tostring(Detections_s.Results)\n | summarize count() by Vulnerability\n | top 10 by count_", + } + ], + "title": "Qualys Vulnerability Management (CCP DEMO)", + } + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/CreateGenericUI.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_microsoft_security_incident_creation_rule..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_microsoft_security_incident_creation_rule..py new file mode 100644 index 0000000000000..48b1a45b42062 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_microsoft_security_incident_creation_rule..py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_microsoft_security_incident_creation_rule..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.alert_rules.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="microsoftSecurityIncidentCreationRuleExample", + alert_rule={ + "etag": '"260097e0-0000-0d00-0000-5d6fa88f0000"', + "kind": "MicrosoftSecurityIncidentCreation", + "properties": { + "displayName": "testing displayname", + "enabled": True, + "productFilter": "Microsoft Cloud App Security", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/alertRules/CreateMicrosoftSecurityIncidentCreationAlertRule.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_nrt_alert_rule..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_nrt_alert_rule..py new file mode 100644 index 0000000000000..b37e18ed05886 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_nrt_alert_rule..py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_nrt_alert_rule..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.alert_rules.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + alert_rule={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "kind": "NRT", + "properties": { + "description": "", + "displayName": "Rule2", + "enabled": True, + "eventGroupingSettings": {"aggregationKind": "AlertPerResult"}, + "incidentConfiguration": { + "createIncident": True, + "groupingConfiguration": { + "enabled": True, + "groupByEntities": ["Host", "Account"], + "lookbackDuration": "PT5H", + "matchingMethod": "Selected", + "reopenClosedIncident": False, + }, + }, + "query": "ProtectionStatus | extend HostCustomEntity = Computer | extend IPCustomEntity = ComputerIP_Hidden", + "severity": "High", + "suppressionDuration": "PT1H", + "suppressionEnabled": False, + "tactics": ["Persistence", "LateralMovement"], + "techniques": ["T1037", "T1021"], + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/alertRules/CreateNrtAlertRule.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_scheduled_alert_rule..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_scheduled_alert_rule..py new file mode 100644 index 0000000000000..752749817c691 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_scheduled_alert_rule..py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_scheduled_alert_rule..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.alert_rules.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + alert_rule={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "kind": "Scheduled", + "properties": { + "alertDetailsOverride": { + "alertDescriptionFormat": "Suspicious activity was made by {{ComputerIP}}", + "alertDisplayNameFormat": "Alert from {{Computer}}", + "alertDynamicProperties": [ + {"alertProperty": "ProductComponentName", "value": "ProductComponentNameCustomColumn"}, + {"alertProperty": "ProductName", "value": "ProductNameCustomColumn"}, + {"alertProperty": "AlertLink", "value": "Link"}, + ], + }, + "customDetails": {"OperatingSystemName": "OSName", "OperatingSystemType": "OSType"}, + "description": "An example for a scheduled rule", + "displayName": "My scheduled rule", + "enabled": True, + "entityMappings": [ + {"entityType": "Host", "fieldMappings": [{"columnName": "Computer", "identifier": "FullName"}]}, + {"entityType": "IP", "fieldMappings": [{"columnName": "ComputerIP", "identifier": "Address"}]}, + ], + "eventGroupingSettings": {"aggregationKind": "AlertPerResult"}, + "incidentConfiguration": { + "createIncident": True, + "groupingConfiguration": { + "enabled": True, + "groupByAlertDetails": ["DisplayName"], + "groupByCustomDetails": ["OperatingSystemType", "OperatingSystemName"], + "groupByEntities": ["Host"], + "lookbackDuration": "PT5H", + "matchingMethod": "Selected", + "reopenClosedIncident": False, + }, + }, + "query": "Heartbeat", + "queryFrequency": "PT1H", + "queryPeriod": "P2DT1H30M", + "sentinelEntitiesMappings": [{"columnName": "Entities"}], + "severity": "High", + "suppressionDuration": "PT1H", + "suppressionEnabled": False, + "tactics": ["Persistence", "LateralMovement"], + "techniques": ["T1037", "T1021"], + "triggerOperator": "GreaterThan", + "triggerThreshold": 0, + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/alertRules/CreateScheduledAlertRule.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_threat_intelligence_taxii_data_connector..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_threat_intelligence_taxii_data_connector..py new file mode 100644 index 0000000000000..9fc1261c9de81 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_threat_intelligence_taxii_data_connector..py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_threat_intelligence_taxii_data_connector..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + data_connector={ + "etag": "d12423f6-a60b-4ca5-88c0-feb1a182d0f0", + "kind": "ThreatIntelligenceTaxii", + "properties": { + "collectionId": "135", + "dataTypes": {"taxiiClient": {"state": "Enabled"}}, + "friendlyName": "testTaxii", + "password": "--", + "pollingFrequency": "OnceADay", + "taxiiLookbackPeriod": "2020-01-01T13:00:30.123Z", + "taxiiServer": "https://limo.anomali.com/api/v1/taxii2/feeds", + "tenantId": "06b3ccb8-1384-4bcc-aec7-852f6d57161b", + "userName": "--", + "workspaceId": "dd124572-4962-4495-9bd2-9dade12314b4", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/CreateThreatIntelligenceTaxiiDataConnector.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_watchlist..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_watchlist..py new file mode 100644 index 0000000000000..b0dd8c45ff1a8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_watchlist..py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_watchlist..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.watchlists.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + watchlist_alias="highValueAsset", + watchlist={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "properties": { + "description": "Watchlist from CSV content", + "displayName": "High Value Assets Watchlist", + "itemsSearchKey": "header1", + "provider": "Microsoft", + "source": "watchlist.csv", + "sourceType": "Local file", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/watchlists/CreateWatchlist.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_watchlist_and_bulk_creates_watchlist_items..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_watchlist_and_bulk_creates_watchlist_items..py new file mode 100644 index 0000000000000..2f916d892936d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_watchlist_and_bulk_creates_watchlist_items..py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_watchlist_and_bulk_creates_watchlist_items..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.watchlists.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + watchlist_alias="highValueAsset", + watchlist={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "properties": { + "contentType": "text/csv", + "description": "Watchlist from CSV content", + "displayName": "High Value Assets Watchlist", + "itemsSearchKey": "header1", + "numberOfLinesToSkip": 1, + "provider": "Microsoft", + "rawContent": "This line will be skipped\nheader1,header2\nvalue1,value2", + "source": "watchlist.csv", + "sourceType": "Local file", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/watchlists/CreateWatchlistAndWatchlistItems.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_watchlist_item..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_watchlist_item..py new file mode 100644 index 0000000000000..c62bbcd01a03e --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_a_watchlist_item..py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_a_watchlist_item..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.watchlist_items.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + watchlist_alias="highValueAsset", + watchlist_item_id="82ba292c-dc97-4dfc-969d-d4dd9e666842", + watchlist_item={ + "etag": "0300bf09-0000-0000-0000-5c37296e0000", + "properties": { + "itemsKeyValue": { + "Business tier": "10.0.2.0/24", + "Data tier": "10.0.2.0/24", + "Gateway subnet": "10.0.255.224/27", + "Private DMZ in": "10.0.0.0/27", + "Public DMZ out": "10.0.0.96/27", + "Web Tier": "10.0.1.0/24", + } + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/watchlists/CreateWatchlistItem.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_action_of_alert_rule..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_action_of_alert_rule..py new file mode 100644 index 0000000000000..8a8f302546264 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_action_of_alert_rule..py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_an_action_of_alert_rule..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.actions.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + action_id="912bec42-cb66-4c03-ac63-1761b6898c3e", + action={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "properties": { + "logicAppResourceId": "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.Logic/workflows/MyAlerts", + "triggerUri": "https://prod-31.northcentralus.logic.azure.com:443/workflows/cd3765391efd48549fd7681ded1d48d7/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=signature", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/actions/CreateActionOfAlertRule.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_activity_entity_query..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_activity_entity_query..py new file mode 100644 index 0000000000000..057da24fbb232 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_activity_entity_query..py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_an_activity_entity_query..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entity_queries.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_query_id="07da3cc8-c8ad-4710-a44e-334cdcb7882b", + entity_query={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "kind": "Activity", + "properties": { + "content": "On '{{Computer}}' the account '{{TargetAccount}}' was deleted by '{{AddedBy}}'", + "description": "Account deleted on host", + "enabled": True, + "entitiesFilter": {"Host_OsFamily": ["Windows"]}, + "inputEntityType": "Host", + "queryDefinitions": { + "query": "let GetAccountActions = (v_Host_Name:string, v_Host_NTDomain:string, v_Host_DnsDomain:string, v_Host_AzureID:string, v_Host_OMSAgentID:string){\nSecurityEvent\n| where EventID in (4725, 4726, 4767, 4720, 4722, 4723, 4724)\n// parsing for Host to handle variety of conventions coming from data\n| extend Host_HostName = case(\nComputer has '@', tostring(split(Computer, '@')[0]),\nComputer has '\\\\', tostring(split(Computer, '\\\\')[1]),\nComputer has '.', tostring(split(Computer, '.')[0]),\nComputer\n)\n| extend Host_NTDomain = case(\nComputer has '\\\\', tostring(split(Computer, '\\\\')[0]), \nComputer has '.', tostring(split(Computer, '.')[-2]), \nComputer\n)\n| extend Host_DnsDomain = case(\nComputer has '\\\\', tostring(split(Computer, '\\\\')[0]), \nComputer has '.', strcat_array(array_slice(split(Computer,'.'),-2,-1),'.'), \nComputer\n)\n| where (Host_HostName =~ v_Host_Name and Host_NTDomain =~ v_Host_NTDomain) \nor (Host_HostName =~ v_Host_Name and Host_DnsDomain =~ v_Host_DnsDomain) \nor v_Host_AzureID =~ _ResourceId \nor v_Host_OMSAgentID == SourceComputerId\n| project TimeGenerated, EventID, Activity, Computer, TargetAccount, TargetUserName, TargetDomainName, TargetSid, SubjectUserName, SubjectUserSid, _ResourceId, SourceComputerId\n| extend AddedBy = SubjectUserName\n// Future support for Activities\n| extend timestamp = TimeGenerated, HostCustomEntity = Computer, AccountCustomEntity = TargetAccount\n};\nGetAccountActions('{{Host_HostName}}', '{{Host_NTDomain}}', '{{Host_DnsDomain}}', '{{Host_AzureID}}', '{{Host_OMSAgentID}}')\n \n| where EventID == 4726 " + }, + "requiredInputFieldsSets": [ + ["Host_HostName", "Host_NTDomain"], + ["Host_HostName", "Host_DnsDomain"], + ["Host_AzureID"], + ["Host_OMSAgentID"], + ], + "templateName": None, + "title": "An account was deleted on this host", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entityQueries/CreateEntityQueryActivity.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_incident..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_incident..py new file mode 100644 index 0000000000000..bb11c162f7a5e --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_incident..py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_an_incident..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incidents.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + incident={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "properties": { + "classification": "FalsePositive", + "classificationComment": "Not a malicious activity", + "classificationReason": "IncorrectAlertLogic", + "description": "This is a demo incident", + "firstActivityTimeUtc": "2019-01-01T13:00:30Z", + "lastActivityTimeUtc": "2019-01-01T13:05:30Z", + "owner": {"objectId": "2046feea-040d-4a46-9e2b-91c2941bfa70"}, + "severity": "High", + "status": "Closed", + "title": "My incident", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/CreateIncident.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_incident_comment..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_incident_comment..py new file mode 100644 index 0000000000000..dfde3c8c4b4fb --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_incident_comment..py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_an_incident_comment..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incident_comments.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + incident_comment_id="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", + incident_comment={"properties": {"message": "Some message"}}, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/comments/CreateIncidentComment.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_incident_relation..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_incident_relation..py new file mode 100644 index 0000000000000..8d9e78e65776d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_incident_relation..py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_an_incident_relation..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incident_relations.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="afbd324f-6c48-459c-8710-8d1e1cd03812", + relation_name="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", + relation={ + "properties": { + "relatedResourceId": "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096" + } + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/relations/CreateIncidentRelation.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_office365_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_office365_data_connector.py new file mode 100644 index 0000000000000..118d7bc3ed2c2 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_office365_data_connector.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_an_office365_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + data_connector={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "kind": "Office365", + "properties": { + "dataTypes": { + "exchange": {"state": "Enabled"}, + "sharePoint": {"state": "Enabled"}, + "teams": {"state": "Enabled"}, + }, + "tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/CreateOfficeDataConnetor.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_office365_project_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_office365_project_data_connector.py new file mode 100644 index 0000000000000..7d21481825422 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_office365_project_data_connector.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_an_office365_project_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + data_connector={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "kind": "Office365Project", + "properties": { + "dataTypes": {"logs": {"state": "Enabled"}}, + "tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/CreateOffice365ProjectDataConnetor.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_office_power_bi_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_office_power_bi_data_connector.py new file mode 100644 index 0000000000000..321bebde4c118 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_office_power_bi_data_connector.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_an_office_power_bi_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + data_connector={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "kind": "OfficePowerBI", + "properties": { + "dataTypes": {"logs": {"state": "Enabled"}}, + "tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/CreateOfficePowerBIDataConnector.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_threat_intelligence_platform_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_threat_intelligence_platform_data_connector.py new file mode 100644 index 0000000000000..9d108948efcdf --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/creates_or_updates_an_threat_intelligence_platform_data_connector.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python creates_or_updates_an_threat_intelligence_platform_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + data_connector={ + "kind": "ThreatIntelligence", + "properties": { + "dataTypes": {"indicators": {"state": "Enabled"}}, + "tenantId": "06b3ccb8-1384-4bcc-aec7-852f6d57161b", + "tipLookbackPeriod": "2020-01-01T13:00:30.123Z", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/CreateThreatIntelligenceDataConnector.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_api_polling_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_api_polling_data_connector.py new file mode 100644 index 0000000000000..4d16aace828cb --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_api_polling_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_a_api_polling_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/DeleteAPIPolling.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_bookmark..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_bookmark..py new file mode 100644 index 0000000000000..b52ea1b3f3088 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_bookmark..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_a_bookmark..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.bookmarks.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + bookmark_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/bookmarks/DeleteBookmark.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_file_import..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_file_import..py new file mode 100644 index 0000000000000..b94e4b0c3a73e --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_file_import..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_a_file_import..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.file_imports.begin_delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + file_import_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ).result() + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/fileImports/DeleteFileImport.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_generic_ui_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_generic_ui_data_connector.py new file mode 100644 index 0000000000000..0c63bbad7c75f --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_generic_ui_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_a_generic_ui_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/DeleteGenericUI.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_security_ml_analytics_settings..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_security_ml_analytics_settings..py new file mode 100644 index 0000000000000..fb6261c02db1c --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_security_ml_analytics_settings..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_a_security_ml_analytics_settings..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.security_ml_analytics_settings.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + settings_resource_name="f209187f-1d17-4431-94af-c141bf5f23db", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/securityMLAnalyticsSettings/DeleteSecurityMLAnalyticsSetting.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_source_control..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_source_control..py new file mode 100644 index 0000000000000..c28f2076a4a34 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_source_control..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_a_source_control..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.source_controls.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + source_control_id="789e0c1f-4a3d-43ad-809c-e713b677b04a", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/sourcecontrols/DeleteSourceControl.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_threat_intelligence_indicator.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_threat_intelligence_indicator.py new file mode 100644 index 0000000000000..72813ae0adb8f --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_threat_intelligence_indicator.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_a_threat_intelligence_indicator.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.threat_intelligence_indicator.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + name="d9cd6f0b-96b9-3984-17cd-a779d1e15a93", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/threatintelligence/DeleteThreatIntelligence.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_watchlist..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_watchlist..py new file mode 100644 index 0000000000000..c4a38cb576af6 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_watchlist..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_a_watchlist..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.watchlists.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + watchlist_alias="highValueAsset", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/watchlists/DeleteWatchlist.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_watchlist_item..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_watchlist_item..py new file mode 100644 index 0000000000000..4d50beebb0d26 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_a_watchlist_item..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_a_watchlist_item..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.watchlist_items.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + watchlist_alias="highValueAsset", + watchlist_item_id="4008512e-1d30-48b2-9ee2-d3612ed9d3ea", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/watchlists/DeleteWatchlistItem.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_action_of_alert_rule..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_action_of_alert_rule..py new file mode 100644 index 0000000000000..7c61f0a6f7b7e --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_action_of_alert_rule..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_an_action_of_alert_rule..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.actions.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + action_id="912bec42-cb66-4c03-ac63-1761b6898c3e", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/actions/DeleteActionOfAlertRule.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_alert_rule..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_alert_rule..py new file mode 100644 index 0000000000000..ca4b9dc913c9c --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_alert_rule..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_an_alert_rule..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.alert_rules.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/alertRules/DeleteAlertRule.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_entity_query..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_entity_query..py new file mode 100644 index 0000000000000..2501507cfd8a1 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_entity_query..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_an_entity_query..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entity_queries.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_query_id="07da3cc8-c8ad-4710-a44e-334cdcb7882b", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entityQueries/DeleteEntityQuery.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_incident..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_incident..py new file mode 100644 index 0000000000000..1ffef240f9515 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_incident..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_an_incident..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incidents.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/DeleteIncident.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office365_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office365_data_connector.py new file mode 100644 index 0000000000000..2b56b00c12c14 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office365_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_an_office365_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/DeleteOfficeDataConnetor.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office365_project_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office365_project_data_connector.py new file mode 100644 index 0000000000000..ac18ca7dab24c --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office365_project_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_an_office365_project_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/DeleteOffice365ProjectDataConnetor.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office_consent..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office_consent..py new file mode 100644 index 0000000000000..b86972a63bad7 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office_consent..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_an_office_consent..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.office_consents.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + consent_id="04e5fd05-ff86-4b97-b8d2-1c20933cb46c", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/officeConsents/DeleteOfficeConsents.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office_power_bi_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office_power_bi_data_connector.py new file mode 100644 index 0000000000000..049cb2d72e66b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_an_office_power_bi_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_an_office_power_bi_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/DeleteOfficePowerBIDataConnetor.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_eyes_on_settings..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_eyes_on_settings..py new file mode 100644 index 0000000000000..9902f69dc7a6a --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_eyes_on_settings..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_eyes_on_settings..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.product_settings.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + settings_name="EyesOn", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/settings/DeleteEyesOnSetting.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_metadata..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_metadata..py new file mode 100644 index 0000000000000..5519f5fa2b140 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_metadata..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_metadata..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.metadata.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + metadata_name="metadataName", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/metadata/DeleteMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_sentinel_onboarding_state.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_sentinel_onboarding_state.py new file mode 100644 index 0000000000000..680f1e8b31f06 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_sentinel_onboarding_state.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_sentinel_onboarding_state.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.sentinel_onboarding_states.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + sentinel_onboarding_state_name="default", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/onboardingStates/DeleteSentinelOnboardingState.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_the_bookmark_relation..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_the_bookmark_relation..py new file mode 100644 index 0000000000000..2b9d119d02ad8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_the_bookmark_relation..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_the_bookmark_relation..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.bookmark_relations.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + bookmark_id="2216d0e1-91e3-4902-89fd-d2df8c535096", + relation_name="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/bookmarks/relations/DeleteBookmarkRelation.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_the_incident_comment..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_the_incident_comment..py new file mode 100644 index 0000000000000..57b68381b543f --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_the_incident_comment..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_the_incident_comment..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incident_comments.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + incident_comment_id="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/comments/DeleteIncidentComment.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_the_incident_relation..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_the_incident_relation..py new file mode 100644 index 0000000000000..627c45c62a8e3 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_the_incident_relation..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_the_incident_relation..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incident_relations.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="afbd324f-6c48-459c-8710-8d1e1cd03812", + relation_name="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/relations/DeleteIncidentRelation.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/disconnect_an_api_polling_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/disconnect_an_api_polling_data_connector.py new file mode 100644 index 0000000000000..5835455e84ecf --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/disconnect_an_api_polling_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python disconnect_an_api_polling_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.disconnect( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/DisconnectAPIPolling.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_insight.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_insight.py new file mode 100644 index 0000000000000..0eed708100dd5 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_insight.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python entity_insight.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get_insights( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + parameters={ + "addDefaultExtendedTimeRange": False, + "endTime": "2021-10-01T00:00:00.000Z", + "insightQueryIds": ["cae8d0aa-aa45-4d53-8d88-17dd64ffd4e4"], + "startTime": "2021-09-01T00:00:00.000Z", + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/insights/PostGetInsights.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_timeline.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_timeline.py new file mode 100644 index 0000000000000..bd15c746b1e91 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_timeline.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python entity_timeline.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities_get_timeline.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + parameters={ + "endTime": "2021-10-01T00:00:00.000Z", + "numberOfBucket": 4, + "startTime": "2021-09-01T00:00:00.000Z", + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/timeline/PostTimelineEntity.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/expand_an_bookmark.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/expand_an_bookmark.py new file mode 100644 index 0000000000000..eae9ed03584ff --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/expand_an_bookmark.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python expand_an_bookmark.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.bookmark.expand( + resource_group_name="myRg", + workspace_name="myWorkspace", + bookmark_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + parameters={ + "endTime": "2020-01-24T17:21:00.000Z", + "expansionId": "27f76e63-c41b-480f-bb18-12ad2e011d49", + "startTime": "2019-12-25T17:21:00.000Z", + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/bookmarks/expand/PostExpandBookmark.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/expand_an_entity.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/expand_an_entity.py new file mode 100644 index 0000000000000..9e8b6a8b33166 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/expand_an_entity.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python expand_an_entity.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.expand( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + parameters={ + "endTime": "2019-05-26T00:00:00.000Z", + "expansionId": "a77992f3-25e9-4d01-99a4-5ff606cc410a", + "startTime": "2019-04-25T00:00:00.000Z", + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/expand/PostExpandEntity.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_anomaly_security_ml_analytics_settings..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_anomaly_security_ml_analytics_settings..py new file mode 100644 index 0000000000000..a20c13f1520c0 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_anomaly_security_ml_analytics_settings..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_anomaly_security_ml_analytics_settings..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.security_ml_analytics_settings.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + settings_resource_name="myFirstAnomalySettings", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/securityMLAnalyticsSettings/GetAnomalySecurityMLAnalyticsSetting.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_api_polling_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_api_polling_data_connector.py new file mode 100644 index 0000000000000..cad8305237ad4 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_api_polling_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_api_polling_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetAPIPolling.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_asc_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_asc_data_connector.py new file mode 100644 index 0000000000000..73ede8d8e2cac --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_asc_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_asc_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="763f9fa1-c2d3-4fa2-93e9-bccd4899aa12", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetAzureSecurityCenterById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_bookmark..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_bookmark..py new file mode 100644 index 0000000000000..82bb12a07c5b3 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_bookmark..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_bookmark..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.bookmarks.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + bookmark_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/bookmarks/GetBookmarkById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_bookmark_relation..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_bookmark_relation..py new file mode 100644 index 0000000000000..3c80d3eb3e687 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_bookmark_relation..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_bookmark_relation..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.bookmark_relations.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + bookmark_id="2216d0e1-91e3-4902-89fd-d2df8c535096", + relation_name="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/bookmarks/relations/GetBookmarkRelationByName.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_cloud_application_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_cloud_application_entity..py new file mode 100644 index 0000000000000..a6579766a041e --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_cloud_application_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_cloud_application_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetCloudApplicationEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_dns_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_dns_entity..py new file mode 100644 index 0000000000000..39f09d1f44382 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_dns_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_dns_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="f4e74920-f2c0-4412-a45f-66d94fdf01f8", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetDnsEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_dynamics365_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_dynamics365_data_connector.py new file mode 100644 index 0000000000000..204339d51be10 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_dynamics365_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_dynamics365_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="c2541efb-c9a6-47fe-9501-87d1017d1512", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetDynamics365DataConnectorById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_file_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_file_entity..py new file mode 100644 index 0000000000000..e9240996b8b0d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_file_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_file_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="af378b21-b4aa-4fe7-bc70-13f8621a322f", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetFileEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_file_hash_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_file_hash_entity..py new file mode 100644 index 0000000000000..2e55630319127 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_file_hash_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_file_hash_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="ea359fa6-c1e5-f878-e105-6344f3e399a1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetFileHashEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_file_import..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_file_import..py new file mode 100644 index 0000000000000..62a4b8ab3d9e2 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_file_import..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_file_import..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.file_imports.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + file_import_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/fileImports/GetFileImportById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_fusion_alert_rule..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_fusion_alert_rule..py new file mode 100644 index 0000000000000..ddbadcbbc5450 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_fusion_alert_rule..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_fusion_alert_rule..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.alert_rules.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="myFirstFusionRule", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/alertRules/GetFusionAlertRule.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_generic_ui_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_generic_ui_data_connector.py new file mode 100644 index 0000000000000..414fff644c1af --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_generic_ui_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_generic_ui_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetGenericUI.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_host_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_host_entity..py new file mode 100644 index 0000000000000..85124f0e24fe1 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_host_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_host_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetHostEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_io_t_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_io_t_data_connector.py new file mode 100644 index 0000000000000..2e7d626fdcdff --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_io_t_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_io_t_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="d2e5dc7a-f3a2-429d-954b-939fa8c2932e", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetIoTById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mail_cluster_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mail_cluster_entity..py new file mode 100644 index 0000000000000..9411ec67b3be0 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mail_cluster_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_mail_cluster_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetMailClusterEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mail_message_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mail_message_entity..py new file mode 100644 index 0000000000000..fa4ca00ed62ad --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mail_message_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_mail_message_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetMailMessageEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mailbox_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mailbox_entity..py new file mode 100644 index 0000000000000..bf29f93f60c9b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mailbox_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_mailbox_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetMailboxEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_malware_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_malware_entity..py new file mode 100644 index 0000000000000..db322029ab638 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_malware_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_malware_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="af378b21-b4aa-4fe7-bc70-13f8621a322f", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetMalwareEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mcas_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mcas_data_connector.py new file mode 100644 index 0000000000000..b2a26be06c1d1 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mcas_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_mcas_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="b96d014d-b5c2-4a01-9aba-a8058f629d42", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetMicrosoftCloudAppSecurityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mdatp_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mdatp_data_connector.py new file mode 100644 index 0000000000000..c9bcf24b38d81 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_mdatp_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_mdatp_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="06b3ccb8-1384-4bcc-aec7-852f6d57161b", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetMicrosoftDefenderAdvancedThreatProtectionById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_microsoft_security_incident_creation_rule..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_microsoft_security_incident_creation_rule..py new file mode 100644 index 0000000000000..4a4360a214fdc --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_microsoft_security_incident_creation_rule..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_microsoft_security_incident_creation_rule..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.alert_rules.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="microsoftSecurityIncidentCreationRuleExample", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/alertRules/GetMicrosoftSecurityIncidentCreationAlertRule.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_microsoft_threat_intelligence_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_microsoft_threat_intelligence_data_connector.py new file mode 100644 index 0000000000000..c57223fca7e13 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_microsoft_threat_intelligence_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_microsoft_threat_intelligence_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="c345bf40-8509-4ed2-b947-50cb773aaf04", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetMicrosoftThreatIntelligenceById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_microsoft_threat_protection_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_microsoft_threat_protection_data_connector.py new file mode 100644 index 0000000000000..2f7b788b8660d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_microsoft_threat_protection_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_microsoft_threat_protection_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="c345bf40-8509-4ed2-b947-50cb773aaf04", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetMicrosoftThreatProtectionById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_process_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_process_entity..py new file mode 100644 index 0000000000000..2334bd5fdc75f --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_process_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_process_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="7264685c-038c-42c6-948c-38e14ef1fb98", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetProcessEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_recommendation..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_recommendation..py new file mode 100644 index 0000000000000..6b0f852c06d50 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_recommendation..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_recommendation..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.get.single_recommendation( + resource_group_name="myRg", + workspace_name="myWorkspace", + recommendation_id="6d4b54eb-8684-4aa3-a156-3aa37b8014bc", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/recommendations/GetRecommendation.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_registry_key_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_registry_key_entity..py new file mode 100644 index 0000000000000..526cc223f4857 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_registry_key_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_registry_key_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetRegistryKeyEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_registry_value_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_registry_value_entity..py new file mode 100644 index 0000000000000..76b5bdb600db9 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_registry_value_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_registry_value_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="dc44bd11-b348-4d76-ad29-37bf7aa41356", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetRegistryValueEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_scheduled_alert_rule..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_scheduled_alert_rule..py new file mode 100644 index 0000000000000..ba27bcaf95292 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_scheduled_alert_rule..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_scheduled_alert_rule..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.alert_rules.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/alertRules/GetScheduledAlertRule.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_security_alert_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_security_alert_entity..py new file mode 100644 index 0000000000000..513f1c988d50d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_security_alert_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_security_alert_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="4aa486e0-6f85-41af-99ea-7acdce7be6c8", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetSecurityAlertEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_security_group_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_security_group_entity..py new file mode 100644 index 0000000000000..dafb26ddd6ece --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_security_group_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_security_group_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetSecurityGroupEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_source_control..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_source_control..py new file mode 100644 index 0000000000000..6765e6c6cc3f0 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_source_control..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_source_control..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.source_controls.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + source_control_id="789e0c1f-4a3d-43ad-809c-e713b677b04a", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/sourcecontrols/GetSourceControlById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_submission_mail_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_submission_mail_entity..py new file mode 100644 index 0000000000000..b7082298af5b5 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_submission_mail_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_submission_mail_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetSubmissionMailEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_ti_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_ti_data_connector.py new file mode 100644 index 0000000000000..d9bc92febfe3e --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_ti_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_ti_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="c345bf40-8509-4ed2-b947-50cb773aaf04", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetThreatIntelligenceById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_ti_taxii_data_connector..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_ti_taxii_data_connector..py new file mode 100644 index 0000000000000..0532bd9c35495 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_ti_taxii_data_connector..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_ti_taxii_data_connector..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="c39bb458-02a7-4b3f-b0c8-71a1d2692652", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetThreatIntelligenceTaxiiById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_url_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_url_entity..py new file mode 100644 index 0000000000000..f30f88c5982b8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_url_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_url_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetUrlEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_watchlist..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_watchlist..py new file mode 100644 index 0000000000000..621fa62739dfb --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_watchlist..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_watchlist..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.watchlists.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + watchlist_alias="highValueAsset", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/watchlists/GetWatchlistByAlias.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_watchlist_item..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_watchlist_item..py new file mode 100644 index 0000000000000..90bc979fbf6ec --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_a_watchlist_item..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_a_watchlist_item..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.watchlist_items.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + watchlist_alias="highValueAsset", + watchlist_item_id="3f8901fe-63d9-4875-9ad5-9fb3b8105797", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/watchlists/GetWatchlistItemById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_alert_rule_template_by_id..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_alert_rule_template_by_id..py new file mode 100644 index 0000000000000..5612023d5bfcb --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_alert_rule_template_by_id..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_alert_rule_template_by_id..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.alert_rule_templates.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + alert_rule_template_id="65360bb0-8986-4ade-a89d-af3cf44d28aa", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/alertRuleTemplates/GetAlertRuleTemplateById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_actions_of_alert_rule..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_actions_of_alert_rule..py new file mode 100644 index 0000000000000..02c0f9b0abf27 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_actions_of_alert_rule..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_actions_of_alert_rule..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.actions.list_by_alert_rule( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/actions/GetAllActionsByAlertRule.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_alert_rule_templates..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_alert_rule_templates..py new file mode 100644 index 0000000000000..47aadd0a70df8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_alert_rule_templates..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_alert_rule_templates..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.alert_rule_templates.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/alertRuleTemplates/GetAlertRuleTemplates.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_alert_rules..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_alert_rules..py new file mode 100644 index 0000000000000..e103cf842d025 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_alert_rules..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_alert_rules..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.alert_rules.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/alertRules/GetAllAlertRules.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_bookmark_relations..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_bookmark_relations..py new file mode 100644 index 0000000000000..fd95d010f976f --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_bookmark_relations..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_bookmark_relations..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.bookmark_relations.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + bookmark_id="2216d0e1-91e3-4902-89fd-d2df8c535096", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/bookmarks/relations/GetAllBookmarkRelations.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_bookmarks..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_bookmarks..py new file mode 100644 index 0000000000000..b9ab07aeff929 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_bookmarks..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_bookmarks..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.bookmarks.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/bookmarks/GetBookmarks.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_data_connectors..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_data_connectors..py new file mode 100644 index 0000000000000..3ca5ed7ebf505 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_data_connectors..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_data_connectors..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetDataConnectors.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entities..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entities..py new file mode 100644 index 0000000000000..37dd730f7499f --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entities..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_entities..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetEntities.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entity_queries..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entity_queries..py new file mode 100644 index 0000000000000..a5ed5d8b116ac --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entity_queries..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_entity_queries..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entity_queries.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entityQueries/GetEntityQueries.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entity_query_templates..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entity_query_templates..py new file mode 100644 index 0000000000000..e350b0c7174a4 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entity_query_templates..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_entity_query_templates..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entity_query_templates.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entityQueryTemplates/GetEntityQueryTemplates.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_file_imports..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_file_imports..py new file mode 100644 index 0000000000000..3a6e1830f894e --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_file_imports..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_file_imports..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.file_imports.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/fileImports/GetFileImports.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_alerts..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_alerts..py new file mode 100644 index 0000000000000..2cdd1a366f2c6 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_alerts..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_incident_alerts..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incidents.list_alerts( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="afbd324f-6c48-459c-8710-8d1e1cd03812", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/GetAllIncidentAlerts.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_bookmarks..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_bookmarks..py new file mode 100644 index 0000000000000..5546e43a05a52 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_bookmarks..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_incident_bookmarks..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incidents.list_bookmarks( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="afbd324f-6c48-459c-8710-8d1e1cd03812", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/GetAllIncidentBookmarks.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_comments..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_comments..py new file mode 100644 index 0000000000000..39891f6d95c20 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_comments..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_incident_comments..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incident_comments.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/comments/GetAllIncidentComments.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_relations..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_relations..py new file mode 100644 index 0000000000000..dc7197f0979cc --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_relations..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_incident_relations..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incident_relations.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="afbd324f-6c48-459c-8710-8d1e1cd03812", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/relations/GetAllIncidentRelations.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incidents..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incidents..py new file mode 100644 index 0000000000000..83508fb5a2788 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incidents..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_incidents..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incidents.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/GetIncidents.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata..py new file mode 100644 index 0000000000000..b2ae4f32b371c --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_metadata..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.metadata.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/metadata/GetAllMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata_with_odata_filter/orderby/skip/top.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata_with_odata_filter/orderby/skip/top.py new file mode 100644 index 0000000000000..846f8d59102d3 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata_with_odata_filter/orderby/skip/top.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_metadata_with_odata_filter/orderby/skip/top.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.metadata.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/metadata/GetAllMetadataOData.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_office_consents..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_office_consents..py new file mode 100644 index 0000000000000..89ace59dbd894 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_office_consents..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_office_consents..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.office_consents.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/officeConsents/GetOfficeConsents.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_operations..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_operations..py new file mode 100644 index 0000000000000..70935a036787b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_operations..py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/operations/ListOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_relations_of_an_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_relations_of_an_entity..py new file mode 100644 index 0000000000000..d8314e0545d98 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_relations_of_an_entity..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_relations_of_an_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities_relations.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="afbd324f-6c48-459c-8710-8d1e1cd03812", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/relations/GetAllEntityRelations.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_security_ml_analytics_settings..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_security_ml_analytics_settings..py new file mode 100644 index 0000000000000..4ee5ff206581a --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_security_ml_analytics_settings..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_security_ml_analytics_settings..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.security_ml_analytics_settings.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/securityMLAnalyticsSettings/GetAllSecurityMLAnalyticsSettings.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_sentinel_onboarding_states.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_sentinel_onboarding_states.py new file mode 100644 index 0000000000000..831dc9957c599 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_sentinel_onboarding_states.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_sentinel_onboarding_states.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.sentinel_onboarding_states.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/onboardingStates/GetAllSentinelOnboardingStates.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_settings..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_settings..py new file mode 100644 index 0000000000000..fe7eb4fac95c2 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_settings..py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_settings..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.product_settings.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/settings/GetAllSettings.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_source_controls..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_source_controls..py new file mode 100644 index 0000000000000..f65fa7f3ec3ab --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_source_controls..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_source_controls..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.source_controls.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/sourcecontrols/GetSourceControls.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_threat_intelligence_indicators.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_threat_intelligence_indicators.py new file mode 100644 index 0000000000000..2ca5143464059 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_threat_intelligence_indicators.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_threat_intelligence_indicators.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.threat_intelligence_indicators.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/threatintelligence/GetThreatIntelligence.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_watchlist_items..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_watchlist_items..py new file mode 100644 index 0000000000000..8e61dfc334bc6 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_watchlist_items..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_watchlist_items..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.watchlist_items.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + watchlist_alias="highValueAsset", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/watchlists/GetWatchlistItems.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_watchlists..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_watchlists..py new file mode 100644 index 0000000000000..a56d04a8e3c13 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_watchlists..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_watchlists..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.watchlists.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/watchlists/GetWatchlists.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aad_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aad_data_connector.py new file mode 100644 index 0000000000000..06861866e48c8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aad_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_aad_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetAzureActiveDirectoryById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aatp_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aatp_data_connector.py new file mode 100644 index 0000000000000..323a70b15dfbd --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aatp_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_aatp_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="07e42cb3-e658-4e90-801c-efa0f29d3d44", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetAzureAdvancedThreatProtectionById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_account_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_account_entity..py new file mode 100644 index 0000000000000..3ce26893d35eb --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_account_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_account_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetAccountEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_action_of_alert_rule..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_action_of_alert_rule..py new file mode 100644 index 0000000000000..e5822c49a31bb --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_action_of_alert_rule..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_action_of_alert_rule..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.actions.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + action_id="912bec42-cb66-4c03-ac63-1761b6898c3e", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/actions/GetActionOfAlertRuleById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_activity_entity_query..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_activity_entity_query..py new file mode 100644 index 0000000000000..c2428394f8400 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_activity_entity_query..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_activity_entity_query..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entity_queries.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_query_id="07da3cc8-c8ad-4710-a44e-334cdcb7882b", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entityQueries/GetActivityEntityQueryById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_activity_entity_query_template..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_activity_entity_query_template..py new file mode 100644 index 0000000000000..7c9b89c31466e --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_activity_entity_query_template..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_activity_entity_query_template..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entity_query_templates.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_query_template_id="07da3cc8-c8ad-4710-a44e-334cdcb7882b", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entityQueryTemplates/GetActivityEntityQueryTemplateById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aws_cloud_trail_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aws_cloud_trail_data_connector.py new file mode 100644 index 0000000000000..97e9d929f4d8d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aws_cloud_trail_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_aws_cloud_trail_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="c345bf40-8509-4ed2-b947-50cb773aaf04", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetAmazonWebServicesCloudTrailById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aws_s3_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aws_s3_data_connector.py new file mode 100644 index 0000000000000..8725e21b448bb --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_aws_s3_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_aws_s3_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="afef3743-0c88-469c-84ff-ca2e87dc1e48", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetAmazonWebServicesS3ById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_azure_resource_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_azure_resource_entity..py new file mode 100644 index 0000000000000..88f3dbeb9699c --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_azure_resource_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_azure_resource_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetAzureResourceEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_entity_relation..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_entity_relation..py new file mode 100644 index 0000000000000..6bafb997c7437 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_entity_relation..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_entity_relation..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entity_relations.get_relation( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="afbd324f-6c48-459c-8710-8d1e1cd03812", + relation_name="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/relations/GetEntityRelationByName.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_expansion_entity_query..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_expansion_entity_query..py new file mode 100644 index 0000000000000..6e0a02aff3d64 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_expansion_entity_query..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_expansion_entity_query..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entity_queries.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_query_id="07da3cc8-c8ad-4710-a44e-334cdcb7882b", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entityQueries/GetExpansionEntityQueryById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_incident..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_incident..py new file mode 100644 index 0000000000000..53a47161cbdb1 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_incident..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_incident..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incidents.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/GetIncidentById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_incident_comment..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_incident_comment..py new file mode 100644 index 0000000000000..b978fe74a9a3e --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_incident_comment..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_incident_comment..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incident_comments.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + incident_comment_id="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/comments/GetIncidentCommentById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_incident_relation..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_incident_relation..py new file mode 100644 index 0000000000000..b5afdd69bbac9 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_incident_relation..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_incident_relation..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incident_relations.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="afbd324f-6c48-459c-8710-8d1e1cd03812", + relation_name="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/relations/GetIncidentRelationByName.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_io_t_device_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_io_t_device_entity..py new file mode 100644 index 0000000000000..2d7f8aca1935d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_io_t_device_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_io_t_device_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetIoTDeviceEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_ip_entity..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_ip_entity..py new file mode 100644 index 0000000000000..e62e7ba7ea2e5 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_ip_entity..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_ip_entity..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetIpEntityById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_nrt_alert_rule..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_nrt_alert_rule..py new file mode 100644 index 0000000000000..9fffa9e0a7f6d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_nrt_alert_rule..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_nrt_alert_rule..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.alert_rules.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/alertRules/GetNrtAlertRule.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office365_data_connector..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office365_data_connector..py new file mode 100644 index 0000000000000..bdd3bf8df25c9 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office365_data_connector..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_office365_data_connector..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetOfficeDataConnetorById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office365_power_bi_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office365_power_bi_data_connector.py new file mode 100644 index 0000000000000..af9eb455a7f34 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office365_power_bi_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_office365_power_bi_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetOfficePowerBIDataConnetorById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office365_project_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office365_project_data_connector.py new file mode 100644 index 0000000000000..86cf5b32c455d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office365_project_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_office365_project_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetOffice365ProjectDataConnetorById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office_atp_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office_atp_data_connector.py new file mode 100644 index 0000000000000..da3584d2273a8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office_atp_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_office_atp_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="3d3e955e-33eb-401d-89a7-251c81ddd660", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetOffice365AdvancedThreatProtectionById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office_consent..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office_consent..py new file mode 100644 index 0000000000000..9c21db21a92a8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office_consent..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_office_consent..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.office_consents.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + consent_id="04e5fd05-ff86-4b97-b8d2-1c20933cb46c", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/officeConsents/GetOfficeConsentsById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office_irm_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office_irm_data_connector.py new file mode 100644 index 0000000000000..f90229a23f2de --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_an_office_irm_data_connector.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_an_office_irm_data_connector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="3d3e955e-33eb-401d-89a7-251c81ddd660", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/dataConnectors/GetMicrosoftInsiderRiskManagementById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entity_query.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entity_query.py new file mode 100644 index 0000000000000..5ba66079c034b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entity_query.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_entity_query.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.entities.queries( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_id="e1d3d618-e11f-478b-98e3-bb381539a8e1", + kind="Insight", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/entities/GetQueries.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_eyes_on_settings..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_eyes_on_settings..py new file mode 100644 index 0000000000000..5c26e9c3d5242 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_eyes_on_settings..py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_eyes_on_settings..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.product_settings.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + settings_name="EyesOn", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/settings/GetEyesOnSetting.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_geodata_for_a_single_ip_address.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_geodata_for_a_single_ip_address.py new file mode 100644 index 0000000000000..e33b38737b8aa --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_geodata_for_a_single_ip_address.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_geodata_for_a_single_ip_address.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.ip_geodata.get( + resource_group_name="myRg", + ip_address="1.2.3.4", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/enrichment/GetGeodataByIp.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_recommendations_list..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_recommendations_list..py new file mode 100644 index 0000000000000..4a2812f24f671 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_recommendations_list..py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_recommendations_list..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.get_recommendations.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/recommendations/GetRecommendations.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_repository_list..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_repository_list..py new file mode 100644 index 0000000000000..132f34c3cf78b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_repository_list..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_repository_list..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.source_control.list_repositories( + resource_group_name="myRg", + workspace_name="myWorkspace", + repo_type="Github", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/repositories/GetRepositories.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_sentinel_onboarding_state.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_sentinel_onboarding_state.py new file mode 100644 index 0000000000000..fc765ca14e114 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_sentinel_onboarding_state.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_sentinel_onboarding_state.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.sentinel_onboarding_states.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + sentinel_onboarding_state_name="default", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/onboardingStates/GetSentinelOnboardingState.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_single_metadata_by_name.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_single_metadata_by_name.py new file mode 100644 index 0000000000000..dc37d53a27dcd --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_single_metadata_by_name.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_single_metadata_by_name.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="2e1dc338-d04d-4443-b721-037eff4fdcac", + ) + + response = client.metadata.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + metadata_name="metadataName", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/metadata/GetMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_threat_intelligence_indicators_metrics..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_threat_intelligence_indicators_metrics..py new file mode 100644 index 0000000000000..035b81f92b1bf --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_threat_intelligence_indicators_metrics..py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_threat_intelligence_indicators_metrics..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.threat_intelligence_indicator_metrics.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/threatintelligence/CollectThreatIntelligenceMetrics.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_whois_information_for_a_single_domain_name.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_whois_information_for_a_single_domain_name.py new file mode 100644 index 0000000000000..dd478b2431d93 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_whois_information_for_a_single_domain_name.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_whois_information_for_a_single_domain_name.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.domain_whois.get( + resource_group_name="myRg", + domain="microsoft.com", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/enrichment/GetWhoisByDomainName.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/gets_all_incident_related_entities.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/gets_all_incident_related_entities.py new file mode 100644 index 0000000000000..f7298c1765be3 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/gets_all_incident_related_entities.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python gets_all_incident_related_entities.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incidents.list_entities( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_id="afbd324f-6c48-459c-8710-8d1e1cd03812", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/incidents/entities/GetAllIncidentEntities.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_run_playbook.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_run_playbook.py new file mode 100644 index 0000000000000..4ea7def7b4689 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_run_playbook.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python incidents_run_playbook.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.incidents.run_playbook( + resource_group_name="myRg", + workspace_name="myWorkspace", + incident_identifier="73e01a99-5cd7-4139-a149-9f2736ff2ar4", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/manualTrigger/Incidents_RunPlaybook.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/update_eyes_on_settings..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/update_eyes_on_settings..py new file mode 100644 index 0000000000000..50d33066017e0 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/update_eyes_on_settings..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python update_eyes_on_settings..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.product_settings.update( + resource_group_name="myRg", + workspace_name="myWorkspace", + settings_name="EyesOn", + settings={"etag": '"0300bf09-0000-0000-0000-5c37296e0000"', "kind": "EyesOn", "properties": {}}, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/settings/UpdateEyesOnSetting.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/update_metadata..py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/update_metadata..py new file mode 100644 index 0000000000000..e26080c57bcc8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/update_metadata..py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python update_metadata..py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.metadata.update( + resource_group_name="myRg", + workspace_name="myWorkspace", + metadata_name="metadataName", + metadata_patch={"properties": {"author": {"email": "email@microsoft.com", "name": "User Name"}}}, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/metadata/PatchMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/view_a_threat_intelligence_indicator_by_name.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/view_a_threat_intelligence_indicator_by_name.py new file mode 100644 index 0000000000000..3ad34c8aab8c7 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/view_a_threat_intelligence_indicator_by_name.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python view_a_threat_intelligence_indicator_by_name.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.threat_intelligence_indicator.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + name="e16ef847-962e-d7b6-9c8b-a33e4bd30e47", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-11-01-preview/examples/threatintelligence/GetThreatIntelligenceById.json +if __name__ == "__main__": + main()